our $debug=0;
our $pd_debug=0;
our $opt_cached;
-our $opt_head;
-#our $opt_workingtree;
-#our $opt_diff=1;
our $opt_help;
-our $opt_verbose;
+our $opt_output;
our $opt_quiet;
+our $opt_verbose;
my %options = (
"cached" => { "optvar"=>\$opt_cached, "desc"=>"Use index" },
- "head" => { "optvar"=>\$opt_head, "desc"=>"Use git show" },
+ "output:s" => { "optvar"=>\$opt_output, "desc"=>"Generate html output"},
"help" => { "optvar"=>\$opt_help, "desc"=>""},
"quiet" => { "optvar"=>\$opt_quiet, "desc"=>""},
"verbose" => { "optvar"=>\$opt_verbose, "desc"=>"" });
# output for the patch.
sub run_diff
{
+ #print "run_diff(" . join(" ", @_) . ")\n";
my ($fh, $c) = $repo->command_output_pipe(@_);
our @patch=();
while(<$fh>)
}
$repo->command_close_pipe($fh, $c);
+ print "Patch size: " . scalar(@patch) . "\n" if $debug;
+
# @patch has slurped diff for all files...
my $filesref = parse_diff ( \@patch );
show_patch_lines($filesref) if $debug;
for my $file (keys(%$filesref))
{
my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$});
+ next if($path !~ /^dali/);
if($suffix eq ".cpp" || $suffix eq ".c" || $suffix eq ".h")
{
get_coverage($file, $filesref);
return $filesref;
}
-
sub calc_patch_coverage_percentage
{
my $filesref = shift;
foreach my $file (keys(%$filesref))
{
+ my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$});
+ next if($path !~ /^dali/);
+
my $covered_lines = 0;
my $uncovered_lines = 0;
my $percent = 0;
if($total_exec > 0) { $percent = 100 * $total_covered_lines / $total_exec; }
- return $percent;
+ return [ $total_exec, $percent ];
}
sub patch_output
}
+sub patch_html_output
+{
+ my $filesref = shift;
+
+ open( my $filehandle, ">", $opt_output ) || die "Can't open $opt_output for writing:$!\n";
+
+ my $OUTPUT_FH = select;
+ select $filehandle;
+ print <<EOH;
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
+"http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<title>Patch Coverage</title>
+</head>
+<body bgcolor="white">
+EOH
+
+ foreach my $file (keys(%$filesref))
+ {
+ my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$});
+ next if($path !~ /^dali/);
+
+ my $patchref = $filesref->{$file}->{"patch"};
+ my $b_lines_ref = $filesref->{$file}->{"b_lines"};
+ my $coverage_ref = $filesref->{$file}->{"coverage"};
+ print "<h2>$file</h2>\n";
+
+ if($coverage_ref)
+ {
+ if( $coverage_ref->{"covered_lines"} > 0
+ ||
+ $coverage_ref->{"uncovered_lines"} > 0 )
+ {
+ print "<p style=\"color:green;\">Covered: " .
+ $coverage_ref->{"covered_lines"} . "<p>" .
+ "<p style=\"color:red;\">Uncovered: " .
+ $coverage_ref->{"uncovered_lines"} . "</span></p>";
+ }
+ }
+ else
+ {
+ print "<p>";
+ my $span=0;
+ if($suffix eq ".cpp" || $suffix eq ".c" || $suffix eq ".h")
+ {
+ print "<span style=\"color:red;\">";
+ $span=1;
+ }
+ print "No coverage found";
+ print "</span>" if $span;
+ }
+ print "</p>";
+
+ for my $patch (@$patchref)
+ {
+ my $hunkstr="Hunk: " . $patch->[0];
+ if( $patch->[1] > 1 )
+ {
+ $hunkstr .= " - " . ($patch->[0]+$patch->[1]-1);
+ }
+ print "<p style=\"font-weight:bold;\">" . $hunkstr . "</p>";
+
+ print "<pre>";
+ for(my $i = 0; $i < $patch->[1]; $i++ )
+ {
+ my $line = $i + $patch->[0];
+ my $num_line_digits=log($line)/log(10);
+ for $i (0..(6-$num_line_digits-1))
+ {
+ print " ";
+ }
+ print "$line ";
+
+ if($coverage_ref)
+ {
+ my $color;
+ if($coverage_ref->{"covered"}->{$line})
+ {
+ print("<span style=\"color:green;\">");
+ }
+ elsif($coverage_ref->{"uncovered"}->{$line})
+ {
+ print("<span style=\"color:red;font-weight:bold;\">");
+ }
+ else
+ {
+ #print("<span style=\"color:black;font-weight:normal;\">");
+ }
+ my $src=$coverage_ref->{"src"}->{$line};
+ chomp($src);
+ #print $color, "$src\n", RESET;
+ print "$src</span>\n";
+ }
+ else
+ {
+ # We don't have coverage data, so print it from the patch instead.
+ my $src = $b_lines_ref->{$line};
+ print "$src\n";
+ }
+ }
+ print "<\pre>\n";
+ }
+ }
+
+ print $filehandle "<hr>\n</body>\n</html>\n";
+ close $filehandle;
+ select $OUTPUT_FH;
+}
+
+
################################################################################
## MAIN ##
################################################################################
my @cmd=('--no-pager','diff','--no-ext-diff','-U0','--no-color');
my $status = $repo->command("status", "-s");
-if( $status eq "" )
+if( $status eq "" && !scalar(@ARGV))
{
- # There are no changes in the index or working tree. Use the last patch instead
+ # There are no changes in the index or working tree, and
+ # no diff arguments to append. Use the last patch instead.
push @cmd, ('HEAD~1','HEAD');
}
-elsif($opt_cached) # TODO: Remove this option. Instead, need full diff
+else
{
- push @cmd, "--cached";
+ # detect if there are only cached changes or only working tree changes
+ my $cached = 0;
+ my $working = 0;
+ for my $fstat ( split(/\n/, $status) )
+ {
+ if(substr( $fstat, 0, 1 ) ne " "){ $cached++; }
+ if(substr( $fstat, 1, 1 ) ne " "){ $working++; }
+ }
+ if($cached > 0 )
+ {
+ if($working == 0)
+ {
+ push @cmd, "--cached";
+ }
+ else
+ {
+ die "Both cached & working files - cannot get correct patch from git\n";
+ # Would have to diff from separate clone.
+ }
+ }
}
push @cmd, @ARGV;
my $filesref = run_diff(@cmd);
-my $percent = calc_patch_coverage_percentage($filesref);
-if( ! $opt_quiet )
+chdir $cwd;
+
+# Check how many actual source files there are in the patch
+my $filecount = 0;
+foreach my $file (keys(%$filesref))
+{
+ my ($name, $path, $suffix) = fileparse($file, qr{\.[^.]*$});
+ next if($path !~ /^dali/);
+ next if($suffix ne ".cpp" && $suffix ne ".c" && $suffix ne ".h");
+ $filecount++;
+}
+if( $filecount == 0 )
+{
+ print "No source files found\n";
+ exit 0; # Exit with no error.
+}
+
+my $percentref = calc_patch_coverage_percentage($filesref);
+if($percentref->[0] == 0)
+{
+ print "No coverable lines found\n";
+ exit 0;
+}
+my $percent = $percentref->[1];
+
+my $color=BOLD RED;
+if($opt_output)
+{
+ print "Outputing to $opt_output\n" if $debug;
+ patch_html_output($filesref);
+}
+elsif( ! $opt_quiet )
{
patch_output($filesref);
- my $color=BOLD RED;
if($percent>=90)
{
$color=GREEN;
}
- printf("Percentage of change covered: $color %5.2f%\n" . RESET, $percent);
+ print RESET;
}
+
+printf("Percentage of change covered: %5.2f%\n", $percent);
+
exit($percent<90);
utc-Dali-Text-Shaping.cpp
utc-Dali-VisualModel.cpp
utc-Dali-Text-Layout.cpp
+ utc-Dali-Text-Controller.cpp
+ utc-Dali-VisualFactoryResolveUrl.cpp
)
# Append list of test harness files (Won't get parsed for test cases)
fontDescriptionRuns = fontDescriptions;
Vector<FontRun>& validFonts = logicalModel->mFontRuns;
- // The default font id.
- FontDefaults fontDefaults;
- fontDefaults.mFontDescription.family = "";
- fontDefaults.familyDefined = true;
- fontDefaults.mDefaultPointSize = 12.f;
- fontDefaults.sizeDefined = true;
+ // The default font description.
+ TextAbstraction::FontDescription fontDescription;
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
fontClient.SetDpi( 96u, 96u );
- const FontId defaultFontId = fontDefaults.GetFontId( fontClient );
-
// Validates the fonts. If there is a character with no assigned font it sets a default one.
// After this call, fonts are validated.
multilanguageSupport.ValidateFonts( utf32Characters,
scripts,
fontDescriptionRuns,
- defaultFontId,
+ fontDescription,
+ TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
0u,
numberOfCharacters,
validFonts );
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <limits>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/internal/text/text-controller.h>
+
+using namespace Dali;
+using namespace Toolkit;
+using namespace Text;
+
+namespace
+{
+
+const char* const OPTION_SELECT_WORD("option-select_word"); // "Select Word" popup option.
+const char* const OPTION_SELECT_ALL("option-select_all"); // "Select All" popup option.
+const char* const OPTION_CUT("optionCut"); // "Cut" popup option.
+const char* const OPTION_COPY("optionCopy"); // "Copy" popup option.
+const char* const OPTION_PASTE("optionPaste"); // "Paste" popup option.
+const char* const OPTION_CLIPBOARD("optionClipboard"); // "Clipboard" popup option.
+
+const Size CONTROL_SIZE( 300.f, 60.f );
+
+class ControlImpl : public ControlInterface
+{
+public:
+ ControlImpl()
+ : ControlInterface()
+ {}
+
+ virtual ~ControlImpl()
+ {}
+
+ virtual void AddDecoration( Actor& actor, bool needsClipping )
+ {}
+
+ virtual void RequestTextRelayout()
+ {}
+
+ virtual void TextChanged()
+ {}
+
+ virtual void MaxLengthReached()
+ {}
+
+ virtual void InputStyleChanged( InputStyle::Mask inputStyleMask )
+ {}
+};
+
+std::string gClipboardText;
+void ContentSelectedCallback( ClipboardEventNotifier& notifier )
+{
+ gClipboardText = notifier.GetContent();
+}
+
+} // namespace
+
+int UtcDaliTextController(void)
+{
+ tet_infoline(" UtcDaliTextController");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControlImpl controlImpl;
+ ControllerPtr controller = Controller::New( controlImpl );
+
+ DALI_TEST_CHECK( controller );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextControllerEnableCursorBlinking(void)
+{
+ tet_infoline(" UtcDaliTextControllerEnableCursorBlinking");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControlImpl controlImpl;
+ ControllerPtr controller = Controller::New( controlImpl );
+
+ DALI_TEST_CHECK( controller );
+
+ // There is no text input enabled.
+ DALI_TEST_CHECK( !controller->GetEnableCursorBlink() );
+
+ // Enable the text input.
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+
+ // Enables the text input.
+ controller->EnableTextInput( decorator );
+
+ // Enables the cursor blink.
+ controller->SetEnableCursorBlink( true );
+
+ DALI_TEST_CHECK( controller->GetEnableCursorBlink() );
+
+ // Disables the cursor blink.
+ controller->SetEnableCursorBlink( false );
+
+ DALI_TEST_CHECK( !controller->GetEnableCursorBlink() );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextControllerImfEvent(void)
+{
+ tet_infoline(" UtcDaliTextController");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControlImpl controlImpl;
+ ControllerPtr controller = Controller::New( controlImpl );
+
+ std::string text;
+ ImfManager::ImfEventData imfEvent;
+
+ DALI_TEST_CHECK( controller );
+
+ // Enable the text input.
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+
+ // Enables the text input.
+ controller->EnableTextInput( decorator );
+
+ // Creates an ImfManager.
+ ImfManager imfManager = ImfManager::Get();
+
+ // Send VOID event.
+ imfEvent = ImfManager::ImfEventData( ImfManager::VOID, "", 0, 0 );
+ controller->OnImfEvent( imfManager, imfEvent );
+
+ controller->GetText( text );
+ DALI_TEST_CHECK( text.empty() );
+
+ // Send COMMIT event.
+ imfEvent = ImfManager::ImfEventData( ImfManager::COMMIT, "Hello ", 0, 6 );
+ controller->OnImfEvent( imfManager, imfEvent );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello ", text, TEST_LOCATION );
+
+ // Send PREEDIT event
+ imfEvent = ImfManager::ImfEventData( ImfManager::PREEDIT, "w", 6, 1 );
+ controller->OnImfEvent( imfManager, imfEvent );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ // Send DELETESURROUNDING event
+ imfEvent = ImfManager::ImfEventData( ImfManager::DELETESURROUNDING, "", -1, 1 );
+ controller->OnImfEvent( imfManager, imfEvent );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello ", text, TEST_LOCATION );
+
+ // Send PREEDIT event
+ imfEvent = ImfManager::ImfEventData( ImfManager::PREEDIT, "wo", 6, 2 );
+ controller->OnImfEvent( imfManager, imfEvent );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello wo", text, TEST_LOCATION );
+
+ // Send GETSURROUNDING event
+ imfEvent = ImfManager::ImfEventData( ImfManager::GETSURROUNDING, "", 0, 0 );
+ controller->OnImfEvent( imfManager, imfEvent );
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello wo", text, TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextControllerTextPopupButtonTouched(void)
+{
+ tet_infoline(" UtcDaliTextControllerTextPopupButtonTouched");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControlImpl controlImpl;
+ ControllerPtr controller = Controller::New( controlImpl );
+
+ DALI_TEST_CHECK( controller );
+
+ std::string text;
+ PushButton button;
+ Property::Map attributes;
+
+ // Enable the text input.
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+
+ // Enables the text input.
+ controller->EnableTextInput( decorator );
+
+ // Creates the text's popup.
+ TextSelectionPopupCallbackInterface& callbackInterface = *controller;
+ TextSelectionPopup textPopup = TextSelectionPopup::New( &callbackInterface );
+
+ Toolkit::TextSelectionPopup::Buttons buttonsToEnable = static_cast<Toolkit::TextSelectionPopup::Buttons>( TextSelectionPopup::CUT |
+ TextSelectionPopup::COPY |
+ TextSelectionPopup::PASTE |
+ TextSelectionPopup::SELECT |
+ TextSelectionPopup::SELECT_ALL |
+ TextSelectionPopup::CLIPBOARD );
+
+ textPopup.EnableButtons( buttonsToEnable );
+ Stage::GetCurrent().Add( textPopup );
+ textPopup.ShowPopup();
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Sets some text.
+ controller->SetText( "Hello world" );
+
+ // Select the whole text.
+ button = PushButton::DownCast( textPopup.FindChildByName( OPTION_SELECT_ALL ) );
+ DALI_TEST_CHECK( button );
+
+ button.DoAction( "buttonClick", attributes );
+
+ // Call relayout to process the input events.
+ controller->Relayout( CONTROL_SIZE );
+
+ // Cut the text.
+ button = PushButton::DownCast( textPopup.FindChildByName( OPTION_CUT ) );
+ DALI_TEST_CHECK( button );
+
+ button.DoAction( "buttonClick", attributes );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_CHECK( text.empty() );
+
+ // Set text again.
+ controller->SetText( "Hello world" );
+
+ // Select the whole text.
+ button = PushButton::DownCast( textPopup.FindChildByName( OPTION_SELECT_ALL ) );
+ DALI_TEST_CHECK( button );
+
+ button.DoAction( "buttonClick", attributes );
+
+ // Call relayout to process the input events.
+ controller->Relayout( CONTROL_SIZE );
+
+ // Copy to the clipboard.
+ button = PushButton::DownCast( textPopup.FindChildByName( OPTION_COPY ) );
+ DALI_TEST_CHECK( button );
+
+ button.DoAction( "buttonClick", attributes );
+
+ // Call relayout to process the input events.
+ controller->Relayout( CONTROL_SIZE );
+
+ // Cut the text.
+ button = PushButton::DownCast( textPopup.FindChildByName( OPTION_CUT ) );
+ DALI_TEST_CHECK( button );
+
+ button.DoAction( "buttonClick", attributes );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_CHECK( text.empty() );
+
+ ClipboardEventNotifier clipboardEventNotifier = ClipboardEventNotifier::Get();
+ clipboardEventNotifier.ContentSelectedSignal().Connect( &ContentSelectedCallback );
+
+ // Paste the text.
+ button = PushButton::DownCast( textPopup.FindChildByName( OPTION_PASTE ) );
+ DALI_TEST_CHECK( button );
+
+ button.DoAction( "buttonClick", attributes );
+
+ // Call relayout to process the input events.
+ controller->Relayout( CONTROL_SIZE );
+
+ DALI_TEST_EQUALS( "Hello world", gClipboardText, TEST_LOCATION );
+
+ // Show the clipboard.
+ button = PushButton::DownCast( textPopup.FindChildByName( OPTION_CLIPBOARD ) );
+ DALI_TEST_CHECK( button );
+
+ button.DoAction( "buttonClick", attributes );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
// Set a known font description
FontDescriptionRun fontDescriptionRun2;
fontDescriptionRun2.characterRun.characterIndex = 17u;
- fontDescriptionRun2.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun2.characterRun.numberOfCharacters = 9u;
fontDescriptionRun2.familyLength = fontFamily2.size();
fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
memcpy( fontDescriptionRun2.familyName, fontFamily2.c_str(), fontDescriptionRun2.familyLength );
fontDescriptionRun2.slantDefined = false;
fontDescriptionRun2.sizeDefined = false;
- const std::string fontFamily3( "TizenSansHebrew" );
+ const std::string fontFamily3( "TizenSans" );
// Set a known font description
FontDescriptionRun fontDescriptionRun3;
- fontDescriptionRun3.characterRun.characterIndex = 28u;
- fontDescriptionRun3.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun3.characterRun.characterIndex = 26u;
+ fontDescriptionRun3.characterRun.numberOfCharacters = 2u;
fontDescriptionRun3.familyLength = fontFamily3.size();
fontDescriptionRun3.familyName = new char[fontDescriptionRun3.familyLength];
memcpy( fontDescriptionRun3.familyName, fontFamily3.c_str(), fontDescriptionRun3.familyLength );
fontDescriptionRun3.slantDefined = false;
fontDescriptionRun3.sizeDefined = false;
- const std::string fontFamily4( "TizenSans" );
+ const std::string fontFamily4( "TizenSansHebrew" );
// Set a known font description
FontDescriptionRun fontDescriptionRun4;
- fontDescriptionRun4.characterRun.characterIndex = 38u;
- fontDescriptionRun4.characterRun.numberOfCharacters = 17u;
+ fontDescriptionRun4.characterRun.characterIndex = 28u;
+ fontDescriptionRun4.characterRun.numberOfCharacters = 10u;
fontDescriptionRun4.familyLength = fontFamily4.size();
fontDescriptionRun4.familyName = new char[fontDescriptionRun4.familyLength];
memcpy( fontDescriptionRun4.familyName, fontFamily4.c_str(), fontDescriptionRun4.familyLength );
fontDescriptionRun4.slantDefined = false;
fontDescriptionRun4.sizeDefined = false;
+ const std::string fontFamily5( "TizenSans" );
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun5;
+ fontDescriptionRun5.characterRun.characterIndex = 38u;
+ fontDescriptionRun5.characterRun.numberOfCharacters = 17u;
+ fontDescriptionRun5.familyLength = fontFamily5.size();
+ fontDescriptionRun5.familyName = new char[fontDescriptionRun5.familyLength];
+ memcpy( fontDescriptionRun5.familyName, fontFamily5.c_str(), fontDescriptionRun5.familyLength );
+ fontDescriptionRun5.familyDefined = true;
+ fontDescriptionRun5.weightDefined = false;
+ fontDescriptionRun5.widthDefined = false;
+ fontDescriptionRun5.slantDefined = false;
+ fontDescriptionRun5.sizeDefined = false;
+
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun1 );
fontDescriptionRuns.PushBack( fontDescriptionRun2 );
fontDescriptionRuns.PushBack( fontDescriptionRun3 );
fontDescriptionRuns.PushBack( fontDescriptionRun4 );
+ fontDescriptionRuns.PushBack( fontDescriptionRun5 );
Size textArea(100.f, 300.f);
Size layoutSize(81.f, 120.f);
float positions[] =
{
1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
- 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
+ 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -3.f, 33.f, -12.f,
1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f,
};
struct LineRun line0 =
{
{ 22u, 6u },
{ 22u, 6u },
- 36.f,
+ 34.f,
15.f,
-5.f,
0.f,
{
{ 38u, 12u },
{ 38u, 12u },
- 80.f,
+ 79.f,
15.f,
-5.f,
- 4.f,
+ 3.f,
0.f,
false,
false
"Hello world demo שלום עולם.\n"
"שלום עולם hello world demo.",
textArea,
- 4u,
+ 5u,
fontDescriptionRuns.Begin(),
layoutSize,
55u,
// Set a known font description
FontDescriptionRun fontDescriptionRun02;
fontDescriptionRun02.characterRun.characterIndex = 17u;
- fontDescriptionRun02.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun02.characterRun.numberOfCharacters = 9u;
fontDescriptionRun02.familyLength = fontHebrew.size();
fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength];
memcpy( fontDescriptionRun02.familyName, fontHebrew.c_str(), fontDescriptionRun02.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun03;
- fontDescriptionRun03.characterRun.characterIndex = 28u;
- fontDescriptionRun03.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun03.familyLength = fontArabic.size();
+ fontDescriptionRun03.characterRun.characterIndex = 26u;
+ fontDescriptionRun03.characterRun.numberOfCharacters = 2u;
+ fontDescriptionRun03.familyLength = fontLatin.size();
fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength];
- memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength );
+ memcpy( fontDescriptionRun03.familyName, fontLatin.c_str(), fontDescriptionRun03.familyLength );
fontDescriptionRun03.familyDefined = true;
fontDescriptionRun03.weightDefined = false;
fontDescriptionRun03.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun04;
- fontDescriptionRun04.characterRun.characterIndex = 42u;
- fontDescriptionRun04.characterRun.numberOfCharacters = 12u;
- fontDescriptionRun04.familyLength = fontLatin.size();
+ fontDescriptionRun04.characterRun.characterIndex = 28u;
+ fontDescriptionRun04.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun04.familyLength = fontArabic.size();
fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength];
- memcpy( fontDescriptionRun04.familyName, fontLatin.c_str(), fontDescriptionRun04.familyLength );
+ memcpy( fontDescriptionRun04.familyName, fontArabic.c_str(), fontDescriptionRun04.familyLength );
fontDescriptionRun04.familyDefined = true;
fontDescriptionRun04.weightDefined = false;
fontDescriptionRun04.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun05;
- fontDescriptionRun05.characterRun.characterIndex = 54u;
- fontDescriptionRun05.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun05.familyLength = fontHebrew.size();
+ fontDescriptionRun05.characterRun.characterIndex = 42u;
+ fontDescriptionRun05.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun05.familyLength = fontLatin.size();
fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength];
- memcpy( fontDescriptionRun05.familyName, fontHebrew.c_str(), fontDescriptionRun05.familyLength );
+ memcpy( fontDescriptionRun05.familyName, fontLatin.c_str(), fontDescriptionRun05.familyLength );
fontDescriptionRun05.familyDefined = true;
fontDescriptionRun05.weightDefined = false;
fontDescriptionRun05.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun06;
- fontDescriptionRun06.characterRun.characterIndex = 64u;
+ fontDescriptionRun06.characterRun.characterIndex = 54u;
fontDescriptionRun06.characterRun.numberOfCharacters = 10u;
fontDescriptionRun06.familyLength = fontHebrew.size();
fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength];
// Set a known font description
FontDescriptionRun fontDescriptionRun07;
- fontDescriptionRun07.characterRun.characterIndex = 74u;
- fontDescriptionRun07.characterRun.numberOfCharacters = 18u;
- fontDescriptionRun07.familyLength = fontLatin.size();
+ fontDescriptionRun07.characterRun.characterIndex = 64u;
+ fontDescriptionRun07.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun07.familyLength = fontHebrew.size();
fontDescriptionRun07.familyName = new char[fontDescriptionRun07.familyLength];
- memcpy( fontDescriptionRun07.familyName, fontLatin.c_str(), fontDescriptionRun07.familyLength );
+ memcpy( fontDescriptionRun07.familyName, fontHebrew.c_str(), fontDescriptionRun07.familyLength );
fontDescriptionRun07.familyDefined = true;
fontDescriptionRun07.weightDefined = false;
fontDescriptionRun07.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun08;
- fontDescriptionRun08.characterRun.characterIndex = 92u;
- fontDescriptionRun08.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun08.characterRun.characterIndex = 74u;
+ fontDescriptionRun08.characterRun.numberOfCharacters = 18u;
fontDescriptionRun08.familyLength = fontLatin.size();
fontDescriptionRun08.familyName = new char[fontDescriptionRun08.familyLength];
memcpy( fontDescriptionRun08.familyName, fontLatin.c_str(), fontDescriptionRun08.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun09;
- fontDescriptionRun09.characterRun.characterIndex = 104u;
- fontDescriptionRun09.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun09.familyLength = fontArabic.size();
+ fontDescriptionRun09.characterRun.characterIndex = 92u;
+ fontDescriptionRun09.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun09.familyLength = fontLatin.size();
fontDescriptionRun09.familyName = new char[fontDescriptionRun09.familyLength];
- memcpy( fontDescriptionRun09.familyName, fontArabic.c_str(), fontDescriptionRun09.familyLength );
+ memcpy( fontDescriptionRun09.familyName, fontLatin.c_str(), fontDescriptionRun09.familyLength );
fontDescriptionRun09.familyDefined = true;
fontDescriptionRun09.weightDefined = false;
fontDescriptionRun09.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun10;
- fontDescriptionRun10.characterRun.characterIndex = 118u;
- fontDescriptionRun10.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun10.familyLength = fontHebrew.size();
+ fontDescriptionRun10.characterRun.characterIndex = 104u;
+ fontDescriptionRun10.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun10.familyLength = fontArabic.size();
fontDescriptionRun10.familyName = new char[fontDescriptionRun10.familyLength];
- memcpy( fontDescriptionRun10.familyName, fontHebrew.c_str(), fontDescriptionRun10.familyLength );
+ memcpy( fontDescriptionRun10.familyName, fontArabic.c_str(), fontDescriptionRun10.familyLength );
fontDescriptionRun10.familyDefined = true;
fontDescriptionRun10.weightDefined = false;
fontDescriptionRun10.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun11;
- fontDescriptionRun11.characterRun.characterIndex = 128u;
- fontDescriptionRun11.characterRun.numberOfCharacters = 17u;
- fontDescriptionRun11.familyLength = fontLatin.size();
+ fontDescriptionRun11.characterRun.characterIndex = 118u;
+ fontDescriptionRun11.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun11.familyLength = fontHebrew.size();
fontDescriptionRun11.familyName = new char[fontDescriptionRun11.familyLength];
- memcpy( fontDescriptionRun11.familyName, fontLatin.c_str(), fontDescriptionRun11.familyLength );
+ memcpy( fontDescriptionRun11.familyName, fontHebrew.c_str(), fontDescriptionRun11.familyLength );
fontDescriptionRun11.familyDefined = true;
fontDescriptionRun11.weightDefined = false;
fontDescriptionRun11.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun12;
- fontDescriptionRun12.characterRun.characterIndex = 145u;
- fontDescriptionRun12.characterRun.numberOfCharacters = 11u;
- fontDescriptionRun12.familyLength = fontHebrew.size();
+ fontDescriptionRun12.characterRun.characterIndex = 128u;
+ fontDescriptionRun12.characterRun.numberOfCharacters = 17u;
+ fontDescriptionRun12.familyLength = fontLatin.size();
fontDescriptionRun12.familyName = new char[fontDescriptionRun12.familyLength];
- memcpy( fontDescriptionRun12.familyName, fontHebrew.c_str(), fontDescriptionRun12.familyLength );
+ memcpy( fontDescriptionRun12.familyName, fontLatin.c_str(), fontDescriptionRun12.familyLength );
fontDescriptionRun12.familyDefined = true;
fontDescriptionRun12.weightDefined = false;
fontDescriptionRun12.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun13;
- fontDescriptionRun13.characterRun.characterIndex = 156u;
- fontDescriptionRun13.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun13.characterRun.characterIndex = 145u;
+ fontDescriptionRun13.characterRun.numberOfCharacters = 9u;
fontDescriptionRun13.familyLength = fontHebrew.size();
fontDescriptionRun13.familyName = new char[fontDescriptionRun13.familyLength];
memcpy( fontDescriptionRun13.familyName, fontHebrew.c_str(), fontDescriptionRun13.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun14;
- fontDescriptionRun14.characterRun.characterIndex = 166u;
- fontDescriptionRun14.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun14.characterRun.characterIndex = 154u;
+ fontDescriptionRun14.characterRun.numberOfCharacters = 2u;
fontDescriptionRun14.familyLength = fontLatin.size();
fontDescriptionRun14.familyName = new char[fontDescriptionRun14.familyLength];
memcpy( fontDescriptionRun14.familyName, fontLatin.c_str(), fontDescriptionRun14.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun15;
- fontDescriptionRun15.characterRun.characterIndex = 178u;
- fontDescriptionRun15.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun15.familyLength = fontArabic.size();
+ fontDescriptionRun15.characterRun.characterIndex = 156u;
+ fontDescriptionRun15.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun15.familyLength = fontHebrew.size();
fontDescriptionRun15.familyName = new char[fontDescriptionRun15.familyLength];
- memcpy( fontDescriptionRun15.familyName, fontArabic.c_str(), fontDescriptionRun15.familyLength );
+ memcpy( fontDescriptionRun15.familyName, fontHebrew.c_str(), fontDescriptionRun15.familyLength );
fontDescriptionRun15.familyDefined = true;
fontDescriptionRun15.weightDefined = false;
fontDescriptionRun15.widthDefined = false;
fontDescriptionRun15.slantDefined = false;
fontDescriptionRun15.sizeDefined = false;
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun16;
+ fontDescriptionRun16.characterRun.characterIndex = 166u;
+ fontDescriptionRun16.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun16.familyLength = fontLatin.size();
+ fontDescriptionRun16.familyName = new char[fontDescriptionRun16.familyLength];
+ memcpy( fontDescriptionRun16.familyName, fontLatin.c_str(), fontDescriptionRun16.familyLength );
+ fontDescriptionRun16.familyDefined = true;
+ fontDescriptionRun16.weightDefined = false;
+ fontDescriptionRun16.widthDefined = false;
+ fontDescriptionRun16.slantDefined = false;
+ fontDescriptionRun16.sizeDefined = false;
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun17;
+ fontDescriptionRun17.characterRun.characterIndex = 178u;
+ fontDescriptionRun17.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun17.familyLength = fontArabic.size();
+ fontDescriptionRun17.familyName = new char[fontDescriptionRun17.familyLength];
+ memcpy( fontDescriptionRun17.familyName, fontArabic.c_str(), fontDescriptionRun17.familyLength );
+ fontDescriptionRun17.familyDefined = true;
+ fontDescriptionRun17.weightDefined = false;
+ fontDescriptionRun17.widthDefined = false;
+ fontDescriptionRun17.slantDefined = false;
+ fontDescriptionRun17.sizeDefined = false;
+
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun01 );
fontDescriptionRuns.PushBack( fontDescriptionRun02 );
fontDescriptionRuns.PushBack( fontDescriptionRun13 );
fontDescriptionRuns.PushBack( fontDescriptionRun14 );
fontDescriptionRuns.PushBack( fontDescriptionRun15 );
+ fontDescriptionRuns.PushBack( fontDescriptionRun16 );
+ fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
Size layoutSize(92.f, 380.f);
float positions[] =
{
1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
- 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
+ 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -3.f, 33.f, -12.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -13.f, 68.f, -9.f, 76.f, -13.f, 80.f, -13.f, 83.f, -9.f, 92.f, -0.f,
0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
- 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -11.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+ 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -12.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
- 1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 80.f, -0.f,
- 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 45.f, -10.f, 56.f, -13.f, 63.f, -10.f, 68.f, -10.f, 76.f, -0.f,
- 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
+ 1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
+ 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
+ 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -3.f, 33.f, -12.f,
1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
};
+
struct LineRun line01 =
{
{ 0u, 12u },
{
{ 22u, 6u },
{ 22u, 6u },
- 36.f,
+ 34.f,
15.f,
-5.f,
0.f,
92.f,
15.f,
-5.f,
- 5.f,
+ 4.f,
0.f,
false,
false
{
{ 74u, 12u },
{ 74u, 12u },
- 80.f,
+ 79.f,
15.f,
-5.f,
- 4.f,
+ 3.f,
0.f,
false,
false
{
{ 92u, 12u },
{ 92u, 12u },
- 79.f,
+ 78.f,
15.f,
-5.f,
- 5.f,
+ 4.f,
0.f,
false,
false
{
{ 128u, 12u },
{ 128u, 12u },
- 82.f,
+ 81.f,
15.f,
-5.f,
- 4.f,
+ 3.f,
0.f,
false,
false
{
{ 140u, 10u },
{ 140u, 10u },
- 77.f,
+ 76.f,
15.f,
-5.f,
4.f,
{
{ 150u, 6u },
{ 150u, 6u },
- 36.f,
+ 34.f,
15.f,
-5.f,
0.f,
{
{ 166u, 12u },
{ 166u, 12u },
- 80.f,
+ 79.f,
15.f,
-5.f,
4.f,
"Hello world demo שלום עולם.\n"
"שלום עולם hello world مرحبا بالعالم\n",
textArea,
- 15u,
+ 17u,
fontDescriptionRuns.Begin(),
layoutSize,
192u,
// Set a known font description
FontDescriptionRun fontDescriptionRun02;
fontDescriptionRun02.characterRun.characterIndex = 17u;
- fontDescriptionRun02.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun02.characterRun.numberOfCharacters = 9u;
fontDescriptionRun02.familyLength = fontHebrew.size();
fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength];
memcpy( fontDescriptionRun02.familyName, fontHebrew.c_str(), fontDescriptionRun02.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun03;
- fontDescriptionRun03.characterRun.characterIndex = 28u;
- fontDescriptionRun03.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun03.familyLength = fontArabic.size();
+ fontDescriptionRun03.characterRun.characterIndex = 26u;
+ fontDescriptionRun03.characterRun.numberOfCharacters = 2u;
+ fontDescriptionRun03.familyLength = fontLatin.size();
fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength];
- memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength );
+ memcpy( fontDescriptionRun03.familyName, fontLatin.c_str(), fontDescriptionRun03.familyLength );
fontDescriptionRun03.familyDefined = true;
fontDescriptionRun03.weightDefined = false;
fontDescriptionRun03.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun04;
- fontDescriptionRun04.characterRun.characterIndex = 42u;
- fontDescriptionRun04.characterRun.numberOfCharacters = 12u;
- fontDescriptionRun04.familyLength = fontLatin.size();
+ fontDescriptionRun04.characterRun.characterIndex = 28u;
+ fontDescriptionRun04.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun04.familyLength = fontArabic.size();
fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength];
- memcpy( fontDescriptionRun04.familyName, fontLatin.c_str(), fontDescriptionRun04.familyLength );
+ memcpy( fontDescriptionRun04.familyName, fontArabic.c_str(), fontDescriptionRun04.familyLength );
fontDescriptionRun04.familyDefined = true;
fontDescriptionRun04.weightDefined = false;
fontDescriptionRun04.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun05;
- fontDescriptionRun05.characterRun.characterIndex = 54u;
- fontDescriptionRun05.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun05.familyLength = fontHebrew.size();
+ fontDescriptionRun05.characterRun.characterIndex = 42u;
+ fontDescriptionRun05.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun05.familyLength = fontLatin.size();
fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength];
- memcpy( fontDescriptionRun05.familyName, fontHebrew.c_str(), fontDescriptionRun05.familyLength );
+ memcpy( fontDescriptionRun05.familyName, fontLatin.c_str(), fontDescriptionRun05.familyLength );
fontDescriptionRun05.familyDefined = true;
fontDescriptionRun05.weightDefined = false;
fontDescriptionRun05.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun06;
- fontDescriptionRun06.characterRun.characterIndex = 64u;
+ fontDescriptionRun06.characterRun.characterIndex = 54u;
fontDescriptionRun06.characterRun.numberOfCharacters = 10u;
fontDescriptionRun06.familyLength = fontHebrew.size();
fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength];
// Set a known font description
FontDescriptionRun fontDescriptionRun07;
- fontDescriptionRun07.characterRun.characterIndex = 74u;
- fontDescriptionRun07.characterRun.numberOfCharacters = 18u;
- fontDescriptionRun07.familyLength = fontLatin.size();
+ fontDescriptionRun07.characterRun.characterIndex = 64u;
+ fontDescriptionRun07.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun07.familyLength = fontHebrew.size();
fontDescriptionRun07.familyName = new char[fontDescriptionRun07.familyLength];
- memcpy( fontDescriptionRun07.familyName, fontLatin.c_str(), fontDescriptionRun07.familyLength );
+ memcpy( fontDescriptionRun07.familyName, fontHebrew.c_str(), fontDescriptionRun07.familyLength );
fontDescriptionRun07.familyDefined = true;
fontDescriptionRun07.weightDefined = false;
fontDescriptionRun07.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun08;
- fontDescriptionRun08.characterRun.characterIndex = 92u;
- fontDescriptionRun08.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun08.characterRun.characterIndex = 74u;
+ fontDescriptionRun08.characterRun.numberOfCharacters = 18u;
fontDescriptionRun08.familyLength = fontLatin.size();
fontDescriptionRun08.familyName = new char[fontDescriptionRun08.familyLength];
memcpy( fontDescriptionRun08.familyName, fontLatin.c_str(), fontDescriptionRun08.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun09;
- fontDescriptionRun09.characterRun.characterIndex = 104u;
- fontDescriptionRun09.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun09.familyLength = fontArabic.size();
+ fontDescriptionRun09.characterRun.characterIndex = 92u;
+ fontDescriptionRun09.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun09.familyLength = fontLatin.size();
fontDescriptionRun09.familyName = new char[fontDescriptionRun09.familyLength];
- memcpy( fontDescriptionRun09.familyName, fontArabic.c_str(), fontDescriptionRun09.familyLength );
+ memcpy( fontDescriptionRun09.familyName, fontLatin.c_str(), fontDescriptionRun09.familyLength );
fontDescriptionRun09.familyDefined = true;
fontDescriptionRun09.weightDefined = false;
fontDescriptionRun09.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun10;
- fontDescriptionRun10.characterRun.characterIndex = 118u;
- fontDescriptionRun10.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun10.familyLength = fontHebrew.size();
+ fontDescriptionRun10.characterRun.characterIndex = 104u;
+ fontDescriptionRun10.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun10.familyLength = fontArabic.size();
fontDescriptionRun10.familyName = new char[fontDescriptionRun10.familyLength];
- memcpy( fontDescriptionRun10.familyName, fontHebrew.c_str(), fontDescriptionRun10.familyLength );
+ memcpy( fontDescriptionRun10.familyName, fontArabic.c_str(), fontDescriptionRun10.familyLength );
fontDescriptionRun10.familyDefined = true;
fontDescriptionRun10.weightDefined = false;
fontDescriptionRun10.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun11;
- fontDescriptionRun11.characterRun.characterIndex = 128u;
- fontDescriptionRun11.characterRun.numberOfCharacters = 17u;
- fontDescriptionRun11.familyLength = fontLatin.size();
+ fontDescriptionRun11.characterRun.characterIndex = 118u;
+ fontDescriptionRun11.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun11.familyLength = fontHebrew.size();
fontDescriptionRun11.familyName = new char[fontDescriptionRun11.familyLength];
- memcpy( fontDescriptionRun11.familyName, fontLatin.c_str(), fontDescriptionRun11.familyLength );
+ memcpy( fontDescriptionRun11.familyName, fontHebrew.c_str(), fontDescriptionRun11.familyLength );
fontDescriptionRun11.familyDefined = true;
fontDescriptionRun11.weightDefined = false;
fontDescriptionRun11.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun12;
- fontDescriptionRun12.characterRun.characterIndex = 145u;
- fontDescriptionRun12.characterRun.numberOfCharacters = 11u;
- fontDescriptionRun12.familyLength = fontHebrew.size();
+ fontDescriptionRun12.characterRun.characterIndex = 128u;
+ fontDescriptionRun12.characterRun.numberOfCharacters = 17u;
+ fontDescriptionRun12.familyLength = fontLatin.size();
fontDescriptionRun12.familyName = new char[fontDescriptionRun12.familyLength];
- memcpy( fontDescriptionRun12.familyName, fontHebrew.c_str(), fontDescriptionRun12.familyLength );
+ memcpy( fontDescriptionRun12.familyName, fontLatin.c_str(), fontDescriptionRun12.familyLength );
fontDescriptionRun12.familyDefined = true;
fontDescriptionRun12.weightDefined = false;
fontDescriptionRun12.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun13;
- fontDescriptionRun13.characterRun.characterIndex = 156u;
- fontDescriptionRun13.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun13.characterRun.characterIndex = 145u;
+ fontDescriptionRun13.characterRun.numberOfCharacters = 9u;
fontDescriptionRun13.familyLength = fontHebrew.size();
fontDescriptionRun13.familyName = new char[fontDescriptionRun13.familyLength];
memcpy( fontDescriptionRun13.familyName, fontHebrew.c_str(), fontDescriptionRun13.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun14;
- fontDescriptionRun14.characterRun.characterIndex = 166u;
- fontDescriptionRun14.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun14.characterRun.characterIndex = 154u;
+ fontDescriptionRun14.characterRun.numberOfCharacters = 2u;
fontDescriptionRun14.familyLength = fontLatin.size();
fontDescriptionRun14.familyName = new char[fontDescriptionRun14.familyLength];
memcpy( fontDescriptionRun14.familyName, fontLatin.c_str(), fontDescriptionRun14.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun15;
- fontDescriptionRun15.characterRun.characterIndex = 178u;
- fontDescriptionRun15.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun15.familyLength = fontArabic.size();
+ fontDescriptionRun15.characterRun.characterIndex = 156u;
+ fontDescriptionRun15.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun15.familyLength = fontHebrew.size();
fontDescriptionRun15.familyName = new char[fontDescriptionRun15.familyLength];
- memcpy( fontDescriptionRun15.familyName, fontArabic.c_str(), fontDescriptionRun15.familyLength );
+ memcpy( fontDescriptionRun15.familyName, fontHebrew.c_str(), fontDescriptionRun15.familyLength );
fontDescriptionRun15.familyDefined = true;
fontDescriptionRun15.weightDefined = false;
fontDescriptionRun15.widthDefined = false;
fontDescriptionRun15.slantDefined = false;
fontDescriptionRun15.sizeDefined = false;
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun16;
+ fontDescriptionRun16.characterRun.characterIndex = 166u;
+ fontDescriptionRun16.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun16.familyLength = fontLatin.size();
+ fontDescriptionRun16.familyName = new char[fontDescriptionRun16.familyLength];
+ memcpy( fontDescriptionRun16.familyName, fontLatin.c_str(), fontDescriptionRun16.familyLength );
+ fontDescriptionRun16.familyDefined = true;
+ fontDescriptionRun16.weightDefined = false;
+ fontDescriptionRun16.widthDefined = false;
+ fontDescriptionRun16.slantDefined = false;
+ fontDescriptionRun16.sizeDefined = false;
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun17;
+ fontDescriptionRun17.characterRun.characterIndex = 178u;
+ fontDescriptionRun17.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun17.familyLength = fontArabic.size();
+ fontDescriptionRun17.familyName = new char[fontDescriptionRun17.familyLength];
+ memcpy( fontDescriptionRun17.familyName, fontArabic.c_str(), fontDescriptionRun17.familyLength );
+ fontDescriptionRun17.familyDefined = true;
+ fontDescriptionRun17.weightDefined = false;
+ fontDescriptionRun17.widthDefined = false;
+ fontDescriptionRun17.slantDefined = false;
+ fontDescriptionRun17.sizeDefined = false;
+
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun01 );
fontDescriptionRuns.PushBack( fontDescriptionRun02 );
fontDescriptionRuns.PushBack( fontDescriptionRun13 );
fontDescriptionRuns.PushBack( fontDescriptionRun14 );
fontDescriptionRuns.PushBack( fontDescriptionRun15 );
+ fontDescriptionRuns.PushBack( fontDescriptionRun16 );
+ fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
Size layoutSize(92.f, 380.f);
float positions[] =
{
1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
- 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
+ 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -3.f, 33.f, -12.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -13.f, 68.f, -9.f, 76.f, -13.f, 80.f, -13.f, 83.f, -9.f, 92.f, -0.f,
0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
- 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -11.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+ 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -12.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
- 1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 80.f, -0.f,
- 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 45.f, -10.f, 56.f, -13.f, 63.f, -10.f, 68.f, -10.f, 76.f, -0.f,
- 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
+ 1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
+ 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
+ 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -3.f, 33.f, -12.f,
1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
};
+
struct LineRun line01 =
{
{ 0u, 12u },
{
{ 22u, 6u },
{ 22u, 6u },
- 36.f,
+ 34.f,
15.f,
-5.f,
0.f,
92.f,
15.f,
-5.f,
- 5.f,
+ 4.f,
0.f,
false,
false
{
{ 74u, 12u },
{ 74u, 12u },
- 80.f,
+ 79.f,
15.f,
-5.f,
- 4.f,
+ 3.f,
0.f,
false,
false
{
{ 92u, 12u },
{ 92u, 12u },
- 79.f,
+ 78.f,
15.f,
-5.f,
- 5.f,
+ 4.f,
0.f,
false,
false
{
{ 128u, 12u },
{ 128u, 12u },
- 82.f,
+ 81.f,
15.f,
-5.f,
- 4.f,
+ 3.f,
0.f,
false,
false
{
{ 140u, 10u },
{ 140u, 10u },
- 77.f,
+ 76.f,
15.f,
-5.f,
4.f,
{
{ 150u, 6u },
{ 150u, 6u },
- 36.f,
+ 34.f,
15.f,
-5.f,
0.f,
{
{ 166u, 12u },
{ 166u, 12u },
- 80.f,
+ 79.f,
15.f,
-5.f,
4.f,
"Hello world demo שלום עולם.\n"
"שלום עולם hello world مرحبا بالعالم\n",
textArea,
- 15u,
+ 17u,
fontDescriptionRuns.Begin(),
layoutSize,
192u,
// Set a known font description
FontDescriptionRun fontDescriptionRun02;
fontDescriptionRun02.characterRun.characterIndex = 17u;
- fontDescriptionRun02.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun02.characterRun.numberOfCharacters = 9u;
fontDescriptionRun02.familyLength = fontHebrew.size();
fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength];
memcpy( fontDescriptionRun02.familyName, fontHebrew.c_str(), fontDescriptionRun02.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun03;
- fontDescriptionRun03.characterRun.characterIndex = 28u;
- fontDescriptionRun03.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun03.familyLength = fontArabic.size();
+ fontDescriptionRun03.characterRun.characterIndex = 26u;
+ fontDescriptionRun03.characterRun.numberOfCharacters = 2u;
+ fontDescriptionRun03.familyLength = fontLatin.size();
fontDescriptionRun03.familyName = new char[fontDescriptionRun03.familyLength];
- memcpy( fontDescriptionRun03.familyName, fontArabic.c_str(), fontDescriptionRun03.familyLength );
+ memcpy( fontDescriptionRun03.familyName, fontLatin.c_str(), fontDescriptionRun03.familyLength );
fontDescriptionRun03.familyDefined = true;
fontDescriptionRun03.weightDefined = false;
fontDescriptionRun03.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun04;
- fontDescriptionRun04.characterRun.characterIndex = 42u;
- fontDescriptionRun04.characterRun.numberOfCharacters = 12u;
- fontDescriptionRun04.familyLength = fontLatin.size();
+ fontDescriptionRun04.characterRun.characterIndex = 28u;
+ fontDescriptionRun04.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun04.familyLength = fontArabic.size();
fontDescriptionRun04.familyName = new char[fontDescriptionRun04.familyLength];
- memcpy( fontDescriptionRun04.familyName, fontLatin.c_str(), fontDescriptionRun04.familyLength );
+ memcpy( fontDescriptionRun04.familyName, fontArabic.c_str(), fontDescriptionRun04.familyLength );
fontDescriptionRun04.familyDefined = true;
fontDescriptionRun04.weightDefined = false;
fontDescriptionRun04.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun05;
- fontDescriptionRun05.characterRun.characterIndex = 54u;
- fontDescriptionRun05.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun05.familyLength = fontHebrew.size();
+ fontDescriptionRun05.characterRun.characterIndex = 42u;
+ fontDescriptionRun05.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun05.familyLength = fontLatin.size();
fontDescriptionRun05.familyName = new char[fontDescriptionRun05.familyLength];
- memcpy( fontDescriptionRun05.familyName, fontHebrew.c_str(), fontDescriptionRun05.familyLength );
+ memcpy( fontDescriptionRun05.familyName, fontLatin.c_str(), fontDescriptionRun05.familyLength );
fontDescriptionRun05.familyDefined = true;
fontDescriptionRun05.weightDefined = false;
fontDescriptionRun05.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun06;
- fontDescriptionRun06.characterRun.characterIndex = 64u;
+ fontDescriptionRun06.characterRun.characterIndex = 54u;
fontDescriptionRun06.characterRun.numberOfCharacters = 10u;
fontDescriptionRun06.familyLength = fontHebrew.size();
fontDescriptionRun06.familyName = new char[fontDescriptionRun06.familyLength];
// Set a known font description
FontDescriptionRun fontDescriptionRun07;
- fontDescriptionRun07.characterRun.characterIndex = 74u;
- fontDescriptionRun07.characterRun.numberOfCharacters = 18u;
- fontDescriptionRun07.familyLength = fontLatin.size();
+ fontDescriptionRun07.characterRun.characterIndex = 64u;
+ fontDescriptionRun07.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun07.familyLength = fontHebrew.size();
fontDescriptionRun07.familyName = new char[fontDescriptionRun07.familyLength];
- memcpy( fontDescriptionRun07.familyName, fontLatin.c_str(), fontDescriptionRun07.familyLength );
+ memcpy( fontDescriptionRun07.familyName, fontHebrew.c_str(), fontDescriptionRun07.familyLength );
fontDescriptionRun07.familyDefined = true;
fontDescriptionRun07.weightDefined = false;
fontDescriptionRun07.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun08;
- fontDescriptionRun08.characterRun.characterIndex = 92u;
- fontDescriptionRun08.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun08.characterRun.characterIndex = 74u;
+ fontDescriptionRun08.characterRun.numberOfCharacters = 18u;
fontDescriptionRun08.familyLength = fontLatin.size();
fontDescriptionRun08.familyName = new char[fontDescriptionRun08.familyLength];
memcpy( fontDescriptionRun08.familyName, fontLatin.c_str(), fontDescriptionRun08.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun09;
- fontDescriptionRun09.characterRun.characterIndex = 104u;
- fontDescriptionRun09.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun09.familyLength = fontArabic.size();
+ fontDescriptionRun09.characterRun.characterIndex = 92u;
+ fontDescriptionRun09.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun09.familyLength = fontLatin.size();
fontDescriptionRun09.familyName = new char[fontDescriptionRun09.familyLength];
- memcpy( fontDescriptionRun09.familyName, fontArabic.c_str(), fontDescriptionRun09.familyLength );
+ memcpy( fontDescriptionRun09.familyName, fontLatin.c_str(), fontDescriptionRun09.familyLength );
fontDescriptionRun09.familyDefined = true;
fontDescriptionRun09.weightDefined = false;
fontDescriptionRun09.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun10;
- fontDescriptionRun10.characterRun.characterIndex = 118u;
- fontDescriptionRun10.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun10.familyLength = fontHebrew.size();
+ fontDescriptionRun10.characterRun.characterIndex = 104u;
+ fontDescriptionRun10.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun10.familyLength = fontArabic.size();
fontDescriptionRun10.familyName = new char[fontDescriptionRun10.familyLength];
- memcpy( fontDescriptionRun10.familyName, fontHebrew.c_str(), fontDescriptionRun10.familyLength );
+ memcpy( fontDescriptionRun10.familyName, fontArabic.c_str(), fontDescriptionRun10.familyLength );
fontDescriptionRun10.familyDefined = true;
fontDescriptionRun10.weightDefined = false;
fontDescriptionRun10.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun11;
- fontDescriptionRun11.characterRun.characterIndex = 128u;
- fontDescriptionRun11.characterRun.numberOfCharacters = 17u;
- fontDescriptionRun11.familyLength = fontLatin.size();
+ fontDescriptionRun11.characterRun.characterIndex = 118u;
+ fontDescriptionRun11.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun11.familyLength = fontHebrew.size();
fontDescriptionRun11.familyName = new char[fontDescriptionRun11.familyLength];
- memcpy( fontDescriptionRun11.familyName, fontLatin.c_str(), fontDescriptionRun11.familyLength );
+ memcpy( fontDescriptionRun11.familyName, fontHebrew.c_str(), fontDescriptionRun11.familyLength );
fontDescriptionRun11.familyDefined = true;
fontDescriptionRun11.weightDefined = false;
fontDescriptionRun11.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun12;
- fontDescriptionRun12.characterRun.characterIndex = 145u;
- fontDescriptionRun12.characterRun.numberOfCharacters = 11u;
- fontDescriptionRun12.familyLength = fontHebrew.size();
+ fontDescriptionRun12.characterRun.characterIndex = 128u;
+ fontDescriptionRun12.characterRun.numberOfCharacters = 17u;
+ fontDescriptionRun12.familyLength = fontLatin.size();
fontDescriptionRun12.familyName = new char[fontDescriptionRun12.familyLength];
- memcpy( fontDescriptionRun12.familyName, fontHebrew.c_str(), fontDescriptionRun12.familyLength );
+ memcpy( fontDescriptionRun12.familyName, fontLatin.c_str(), fontDescriptionRun12.familyLength );
fontDescriptionRun12.familyDefined = true;
fontDescriptionRun12.weightDefined = false;
fontDescriptionRun12.widthDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun13;
- fontDescriptionRun13.characterRun.characterIndex = 156u;
- fontDescriptionRun13.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun13.characterRun.characterIndex = 145u;
+ fontDescriptionRun13.characterRun.numberOfCharacters = 9u;
fontDescriptionRun13.familyLength = fontHebrew.size();
fontDescriptionRun13.familyName = new char[fontDescriptionRun13.familyLength];
memcpy( fontDescriptionRun13.familyName, fontHebrew.c_str(), fontDescriptionRun13.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun14;
- fontDescriptionRun14.characterRun.characterIndex = 166u;
- fontDescriptionRun14.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun14.characterRun.characterIndex = 154u;
+ fontDescriptionRun14.characterRun.numberOfCharacters = 2u;
fontDescriptionRun14.familyLength = fontLatin.size();
fontDescriptionRun14.familyName = new char[fontDescriptionRun14.familyLength];
memcpy( fontDescriptionRun14.familyName, fontLatin.c_str(), fontDescriptionRun14.familyLength );
// Set a known font description
FontDescriptionRun fontDescriptionRun15;
- fontDescriptionRun15.characterRun.characterIndex = 178u;
- fontDescriptionRun15.characterRun.numberOfCharacters = 14u;
- fontDescriptionRun15.familyLength = fontArabic.size();
+ fontDescriptionRun15.characterRun.characterIndex = 156u;
+ fontDescriptionRun15.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun15.familyLength = fontHebrew.size();
fontDescriptionRun15.familyName = new char[fontDescriptionRun15.familyLength];
- memcpy( fontDescriptionRun15.familyName, fontArabic.c_str(), fontDescriptionRun15.familyLength );
+ memcpy( fontDescriptionRun15.familyName, fontHebrew.c_str(), fontDescriptionRun15.familyLength );
fontDescriptionRun15.familyDefined = true;
fontDescriptionRun15.weightDefined = false;
fontDescriptionRun15.widthDefined = false;
fontDescriptionRun15.slantDefined = false;
fontDescriptionRun15.sizeDefined = false;
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun16;
+ fontDescriptionRun16.characterRun.characterIndex = 166u;
+ fontDescriptionRun16.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun16.familyLength = fontLatin.size();
+ fontDescriptionRun16.familyName = new char[fontDescriptionRun16.familyLength];
+ memcpy( fontDescriptionRun16.familyName, fontLatin.c_str(), fontDescriptionRun16.familyLength );
+ fontDescriptionRun16.familyDefined = true;
+ fontDescriptionRun16.weightDefined = false;
+ fontDescriptionRun16.widthDefined = false;
+ fontDescriptionRun16.slantDefined = false;
+ fontDescriptionRun16.sizeDefined = false;
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun17;
+ fontDescriptionRun17.characterRun.characterIndex = 178u;
+ fontDescriptionRun17.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun17.familyLength = fontArabic.size();
+ fontDescriptionRun17.familyName = new char[fontDescriptionRun17.familyLength];
+ memcpy( fontDescriptionRun17.familyName, fontArabic.c_str(), fontDescriptionRun17.familyLength );
+ fontDescriptionRun17.familyDefined = true;
+ fontDescriptionRun17.weightDefined = false;
+ fontDescriptionRun17.widthDefined = false;
+ fontDescriptionRun17.slantDefined = false;
+ fontDescriptionRun17.sizeDefined = false;
+
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun01 );
fontDescriptionRuns.PushBack( fontDescriptionRun02 );
fontDescriptionRuns.PushBack( fontDescriptionRun13 );
fontDescriptionRuns.PushBack( fontDescriptionRun14 );
fontDescriptionRuns.PushBack( fontDescriptionRun15 );
+ fontDescriptionRuns.PushBack( fontDescriptionRun16 );
+ fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
Size layoutSize(92.f, 380.f);
float positions[] =
{
1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
- 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
+ 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -3.f, 33.f, -12.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -13.f, 68.f, -9.f, 76.f, -13.f, 80.f, -13.f, 83.f, -9.f, 92.f, -0.f,
0.f, -9.f, 11.f, -9.f, 21.f, -9.f, 27.f, -13.f, 30.f, -13.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
- 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -11.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
+ 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -3.f, 42.f, -12.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f, 59.f, -10.f, 70.f, -13.f, 77.f, -10.f, 82.f, -10.f, 90.f, -0.f,
1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -0.f,
- 1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 41.f, -9.f, 52.f, -9.f, 62.f, -9.f, 68.f, -13.f, 71.f, -13.f, 80.f, -0.f,
- 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 45.f, -10.f, 56.f, -13.f, 63.f, -10.f, 68.f, -10.f, 76.f, -0.f,
- 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 32.f, -2.f, 35.f, -11.f,
+ 1.f, -12.f, 12.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
+ 0.f, -13.f, 10.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -0.f, 44.f, -10.f, 55.f, -13.f, 62.f, -10.f, 67.f, -10.f, 75.f, -0.f,
+ 1.f, -10.f, 9.f, -10.f, 14.f, -13.f, 22.f, -10.f, 30.f, -3.f, 33.f, -12.f,
1.f, -10.f, 12.f, -13.f, 19.f, -10.f, 24.f, -10.f, 32.f, -0.f, 37.f, -10.f, 45.f, -10.f, 50.f, -13.f, 58.f, -10.f, 66.f, -0.f,
- 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 39.f, -9.f, 50.f, -9.f, 60.f, -9.f, 66.f, -13.f, 69.f, -13.f, 78.f, -0.f,
+ 1.f, -13.f, 10.f, -9.f, 18.f, -13.f, 22.f, -13.f, 25.f, -9.f, 34.f, -0.f, 38.f, -9.f, 49.f, -9.f, 59.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -0.f,
0.f, -8.f, 7.f, -6.f, 12.f, -7.f, 18.f, -7.f, 23.f, -11.f, 25.f, -0.f, 27.f, -7.f, 32.f, -11.f, 33.f, -11.f, 37.f, -8.f, 44.f, -11.f, 45.f, -11.f, 49.f, -8.f, 55.f, -0.f,
};
+
struct LineRun line01 =
{
{ 0u, 12u },
{
{ 22u, 6u },
{ 22u, 6u },
- 36.f,
+ 34.f,
15.f,
-5.f,
0.f,
92.f,
15.f,
-5.f,
- 5.f,
+ 4.f,
0.f,
false,
false
{
{ 74u, 12u },
{ 74u, 12u },
- 80.f,
+ 79.f,
15.f,
-5.f,
- 4.f,
+ 3.f,
0.f,
false,
false
{
{ 92u, 12u },
{ 92u, 12u },
- 79.f,
+ 78.f,
15.f,
-5.f,
- 5.f,
+ 4.f,
0.f,
false,
false
{
{ 128u, 12u },
{ 128u, 12u },
- 82.f,
+ 81.f,
15.f,
-5.f,
- 4.f,
+ 3.f,
0.f,
false,
false
{
{ 140u, 10u },
{ 140u, 10u },
- 77.f,
+ 76.f,
15.f,
-5.f,
4.f,
{
{ 150u, 6u },
{ 150u, 6u },
- 36.f,
+ 34.f,
15.f,
-5.f,
0.f,
{
{ 166u, 12u },
{ 166u, 12u },
- 80.f,
+ 79.f,
15.f,
-5.f,
4.f,
false,
false
};
-
Vector<LineRun> lines;
lines.PushBack( line01 );
lines.PushBack( line02 );
"Hello world demo שלום עולם.\n"
"שלום עולם hello world مرحبا بالعالم\n",
textArea,
- 15u,
+ 17u,
fontDescriptionRuns.Begin(),
layoutSize,
192u,
// Tests the following functions with different scripts.
//
// void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
-// Vector<FontId>& fontIds,
-// Vector<bool>& isDefaultFont,
// const TextAbstraction::FontDescription& defaultFontDescription,
// TextAbstraction::PointSize26Dot6 defaultPointSize,
-// CharacterIndex startIndex,
-// Length numberOfCharacters );
+// CharacterIndex characterIndex,
+// TextAbstraction::FontDescription& fontDescription,
+// TextAbstraction::PointSize26Dot6& fontPointSize,
+// bool& isDefaultFont );
//
// Script GetScript( Length index,
// Vector<ScriptRun>::ConstIterator& scriptRunIt,
// void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
// const Vector<ScriptRun>& scripts,
// const Vector<FontDescriptionRun>& fontDescriptions,
-// FontId defaultFontId,
+// const TextAbstraction::FontDescription& defaultFontDescription,
+// TextAbstraction::PointSize26Dot6 defaultFontPointSize,
// CharacterIndex startIndex,
// Length numberOfCharacters,
// Vector<FontRun>& fonts );
};
//////////////////////////////////////////////////////////
+void PrintFontDescription( FontId id )
+{
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+ TextAbstraction::FontDescription description;
+ fontClient.GetDescription( id, description );
+
+ const TextAbstraction::PointSize26Dot6 pointSize = fontClient.GetPointSize( id );
+
+ std::cout << std::endl << " font description for font id : " << id << std::endl;
+ std::cout << " font family : [" << description.family << "]" << std::endl;
+ std::cout << " font width : [" << TextAbstraction::FontWidth::Name[description.width] << "]" << std::endl;
+ std::cout << " font weight : [" << TextAbstraction::FontWeight::Name[description.weight] << "]" << std::endl;
+ std::cout << " font slant : [" << TextAbstraction::FontSlant::Name[description.slant] << "]" << std::endl;
+ std::cout << " font size : " << pointSize << std::endl;
+}
bool MergeFontDescriptionsTest( const MergeFontDescriptionsData& data )
{
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
Vector<FontId> fontIds;
fontIds.Resize( data.startIndex + data.numberOfCharacters, 0u );
Vector<bool> isDefaultFont;
isDefaultFont.Resize( data.startIndex + data.numberOfCharacters, true );
- MergeFontDescriptions( data.fontDescriptionRuns,
- fontIds,
- isDefaultFont,
- data.defaultFontDescription,
- data.defaultPointSize,
- data.startIndex,
- data.numberOfCharacters );
+ for( unsigned int index = data.startIndex; index < data.startIndex + data.numberOfCharacters; ++index )
+ {
+ TextAbstraction::FontDescription fontDescription;
+ TextAbstraction::PointSize26Dot6 fontPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
+
+ MergeFontDescriptions( data.fontDescriptionRuns,
+ data.defaultFontDescription,
+ data.defaultPointSize,
+ index,
+ fontDescription,
+ fontPointSize,
+ isDefaultFont[index] );
+
+ if( !isDefaultFont[index] )
+ {
+ fontIds[index] = fontClient.GetFontId( fontDescription, fontPointSize );
+ }
+ }
if( fontIds.Count() != data.expectedFontIds.Count() )
{
if( scripts.Count() != data.scriptRuns.Count() )
{
tet_printf("ScriptsTest FAIL: different number of scripts. %d, should be %d\n", scripts.Count(), data.scriptRuns.Count() );
+ for( Vector<ScriptRun>::ConstIterator it = scripts.Begin(); it != scripts.End(); ++it)
+ {
+ const ScriptRun& run = *it;
+
+ std::cout << " index : " << run.characterRun.characterIndex << ", num chars : " << run.characterRun.numberOfCharacters << ", script : [" << TextAbstraction::ScriptName[run.script] << "]" << std::endl;
+ }
return false;
}
// Get the default font id.
const FontId defaultFontId = fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + data.defaultFont,
data.defaultFontSize );
+ TextAbstraction::FontDescription defaultFontDescription;
+ fontClient.GetDescription( defaultFontId, defaultFontDescription );
+
+ const TextAbstraction::PointSize26Dot6 defaultPointSize = fontClient.GetPointSize( defaultFontId );
Vector<FontRun> fontRuns;
multilanguageSupport.ValidateFonts( utf32,
scripts,
data.fontDescriptionRuns,
- defaultFontId,
+ defaultFontDescription,
+ defaultPointSize,
0u,
numberOfCharacters,
fontRuns );
multilanguageSupport.ValidateFonts( utf32,
scripts,
data.fontDescriptionRuns,
- defaultFontId,
+ defaultFontDescription,
+ defaultPointSize,
data.index,
data.numberOfCharacters,
fontRuns );
},
const_cast<char*>( "DejaVu Sans" ),
11u,
- TextAbstraction::FontWeight::NORMAL,
- TextAbstraction::FontWidth::NORMAL,
- TextAbstraction::FontSlant::NORMAL,
+ TextAbstraction::FontWeight::NONE,
+ TextAbstraction::FontWidth::NONE,
+ TextAbstraction::FontSlant::NONE,
TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
true,
false,
},
NULL,
0u,
- TextAbstraction::FontWeight::NORMAL,
- TextAbstraction::FontWidth::NORMAL,
+ TextAbstraction::FontWeight::NONE,
+ TextAbstraction::FontWidth::NONE,
TextAbstraction::FontSlant::ITALIC,
TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
false,
NULL,
0u,
TextAbstraction::FontWeight::BOLD,
- TextAbstraction::FontWidth::NORMAL,
- TextAbstraction::FontSlant::NORMAL,
+ TextAbstraction::FontWidth::NONE,
+ TextAbstraction::FontSlant::NONE,
TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
false,
true,
},
NULL,
0u,
- TextAbstraction::FontWeight::NORMAL,
- TextAbstraction::FontWidth::NORMAL,
- TextAbstraction::FontSlant::NORMAL,
+ TextAbstraction::FontWeight::NONE,
+ TextAbstraction::FontWidth::NONE,
+ TextAbstraction::FontSlant::NONE,
NON_DEFAULT_FONT_SIZE,
false,
false,
},
NULL,
0u,
- TextAbstraction::FontWeight::NORMAL,
+ TextAbstraction::FontWeight::NONE,
TextAbstraction::FontWidth::EXPANDED,
- TextAbstraction::FontSlant::NORMAL,
+ TextAbstraction::FontSlant::NONE,
TextAbstraction::FontClient::DEFAULT_POINT_SIZE,
false,
false,
{
{
0u,
- 16u,
+ 15u,
},
TextAbstraction::LATIN
};
{
{
0u,
- 16u,
+ 15u,
},
TextAbstraction::LATIN
};
{
{
0u,
- 16u,
+ 15u,
},
TextAbstraction::LATIN
};
},
{
"White spaces. At the beginning of the text.",
- " Hello world.",
+ " Hello world",
0u,
- 16u,
+ 15u,
scriptRuns04,
},
{
"White spaces. At the end of the text.",
- "Hello world. ",
+ "Hello world ",
0u,
- 16u,
+ 15u,
scriptRuns05,
},
{
"White spaces. At the middle of the text.",
- "Hello world.",
+ "Hello world",
0u,
- 16u,
+ 15u,
scriptRuns06,
},
{
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/internal/visuals/visual-factory-resolve-url.h>
+
+using namespace Dali::Toolkit::Internal;
+
+int UtcDaliResolveUrlRegularImage(void)
+{
+ tet_infoline( "UtcDaliResolveUrl REGULAR_IMAGE" );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.jpeg"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.gif"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.PNG"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.Png123"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("foobar.Png1.23"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType(""), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType(" "), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("."), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("9"), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliResolveUrlSvg(void)
+{
+ tet_infoline( "UtcDaliResolveUrl SVG" );
+
+ DALI_TEST_EQUALS( UrlType::SVG, ResolveUrlType("foobar.svg"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::SVG, ResolveUrlType("foobar.svg.svg"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::SVG, ResolveUrlType("foobar.svG"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::SVG, ResolveUrlType("foobar.SVG"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::SVG, ResolveUrlType(".SvG"), TEST_LOCATION );
+
+ // SVGs aren't N-patch
+ DALI_TEST_EQUALS( UrlType::SVG, ResolveUrlType("foobar.9.svg"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("svg.png"), TEST_LOCATION );
+
+ // maybe controversial, but for now we expect the suffix to be exactly .svg
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("svg.svg1"), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliResolveUrlNPatch(void)
+{
+ tet_infoline( "UtcDaliResolveUrl N_PATCH" );
+
+ DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.9.gif"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.#.png"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.9.9.bmp"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.9.9.jpg[]=$$"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::N_PATCH, ResolveUrlType("foobar.9.#.#.9.wbpm123"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("svg.##.png"), TEST_LOCATION );
+
+ DALI_TEST_EQUALS( UrlType::REGULAR_IMAGE, ResolveUrlType("svg.99.jpeg"), TEST_LOCATION );
+
+ END_TEST;
+}
/*
- * Copyright (c) 2014 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.
* limitations under the License.
*/
+#include <dali/devel-api/adaptor-framework/style-monitor.h>
+
#include <iostream>
#include <stdlib.h>
#include <dali-toolkit-test-suite-utils.h>
test_return_value = TET_PASS;
}
-
int UtcDaliStyleManagerConstructorP(void)
{
ToolkitTestApplication application;
}
-int UtcDaliStyleManagerStyleChangedSignal(void)
+int UtcDaliStyleManagerStyleChangedSignalFontFamily(void)
{
- tet_infoline("Test that the StyleChange signal is fired when the font size is altered" );
+ tet_infoline("Test that the StyleChange signal is fired when the font family is altered" );
Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
defaultTheme );
Stage::GetCurrent().Add( label2 );
StyleChangedSignalChecker styleChangedSignalHandler;
- StyleMonitor styleMonitor = StyleMonitor::Get();
+ Dali::StyleMonitor styleMonitor = Dali::StyleMonitor::Get();
StyleManager styleManager = StyleManager::Get();
styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
DALI_TEST_EQUALS( familyStr, "Times New Roman", TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliStyleManagerStyleChangedSignalFontSize(void)
+{
+ tet_infoline("Test that the StyleChange signal is fired when the font size is altered" );
+
+ const char* defaultTheme =
+ "{\n"
+ " \"styles\":\n"
+ " {\n"
+ " \"textlabelFontSize0\":\n"
+ " {\n"
+ " \"pointSize\":10\n"
+ " },\n"
+ " \"textlabelFontSize1\":\n"
+ " {\n"
+ " \"pointSize\":10\n"
+ " },\n"
+ " \"textlabelFontSize2\":\n"
+ " {\n"
+ " \"pointSize\":12\n"
+ " },\n"
+ " \"textlabelFontSize3\":\n"
+ " {\n"
+ " \"pointSize\":14\n"
+ " },\n"
+ " \"textlabelFontSize4\":\n"
+ " {\n"
+ " \"pointSize\":16\n"
+ " }\n"
+ " }\n"
+ "}\n";
+
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json", defaultTheme );
+
+ ToolkitTestApplication application;
+
+ std::string labelStr("Label");
+ Toolkit::TextLabel label = Toolkit::TextLabel::New(labelStr);
+ Stage::GetCurrent().Add( label );
+
+ Toolkit::TextLabel label2 = Toolkit::TextLabel::New(labelStr);
+ Stage::GetCurrent().Add( label2 );
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ StyleMonitor styleMonitor = StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 10.0f);
+
+ styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
+
+ Test::StyleMonitor::SetDefaultFontSize(2);
+ styleMonitor.StyleChangeSignal().Emit( styleMonitor, StyleChange::DEFAULT_FONT_SIZE_CHANGE);
+
+ tet_infoline("Test that the StyleChanged signal is received only once");
+ DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+
+ tet_infoline("Test that the label's font size has been altered\n");
+ Property::Value pointSizeValue = label.GetProperty(TextLabel::Property::POINT_SIZE);
+ float pointSize;
+ pointSizeValue.Get( pointSize );
+
+ DALI_TEST_EQUALS( pointSize, 12.0f, 0.001, TEST_LOCATION );
+
+ styleChangedSignalHandler.signalCount = 0;
+
+ Test::StyleMonitor::SetDefaultFontSize(4);
+ styleMonitor.StyleChangeSignal().Emit( styleMonitor, StyleChange::DEFAULT_FONT_SIZE_CHANGE);
+
+ tet_infoline("Test that the StyleChanged signal is received only once");
+ DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+
+ // Check that the label's font style has been altered
+ pointSizeValue = label.GetProperty(TextLabel::Property::POINT_SIZE);
+ pointSizeValue.Get( pointSize );
+
+ DALI_TEST_EQUALS( pointSize, 16.0f, 0.001, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+
+int UtcDaliStyleManagerStyleChangedSignalFontSizeTextField(void)
+{
+ tet_infoline("Test that the StyleChange signal is fired when the font size is altered" );
+
+ const char* defaultTheme =
+ "{\n"
+ " \"styles\":\n"
+ " {\n"
+ " \"textfieldFontSize0\":\n"
+ " {\n"
+ " \"pointSize\":8\n"
+ " },\n"
+ " \"textfieldFontSize1\":\n"
+ " {\n"
+ " \"pointSize\":10\n"
+ " },\n"
+ " \"textfieldFontSize2\":\n"
+ " {\n"
+ " \"pointSize\":12\n"
+ " },\n"
+ " \"textfieldFontSize3\":\n"
+ " {\n"
+ " \"pointSize\":14\n"
+ " },\n"
+ " \"textfieldFontSize4\":\n"
+ " {\n"
+ " \"pointSize\":16\n"
+ " }\n"
+ " }\n"
+ "}\n";
+
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json", defaultTheme );
+
+ ToolkitTestApplication application;
+
+ std::string fieldStr("Field");
+ Toolkit::TextField field = Toolkit::TextField::New();
+ field.SetProperty( Toolkit::TextField::Property::TEXT, fieldStr );
+ Stage::GetCurrent().Add( field );
+
+ Toolkit::TextField field2 = Toolkit::TextField::New();
+ Stage::GetCurrent().Add( field2 );
+ field2.SetProperty( Toolkit::TextField::Property::TEXT, fieldStr );
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ StyleMonitor styleMonitor = StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ field.SetProperty(TextField::Property::POINT_SIZE, 10.0f);
+
+ styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
+
+ Test::StyleMonitor::SetDefaultFontSize(2);
+ styleMonitor.StyleChangeSignal().Emit( styleMonitor, StyleChange::DEFAULT_FONT_SIZE_CHANGE);
+
+ tet_infoline("Test that the StyleChanged signal is received only once");
+ DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+
+ tet_infoline("Test that the field's font size has been altered\n");
+ Property::Value pointSizeValue = field.GetProperty(TextField::Property::POINT_SIZE);
+ float pointSize;
+ pointSizeValue.Get( pointSize );
+
+ DALI_TEST_EQUALS( pointSize, 12.0f, 0.001, TEST_LOCATION );
+
+ styleChangedSignalHandler.signalCount = 0;
+
+ Test::StyleMonitor::SetDefaultFontSize(4);
+ styleMonitor.StyleChangeSignal().Emit( styleMonitor, StyleChange::DEFAULT_FONT_SIZE_CHANGE);
+
+ tet_infoline("Test that the StyleChanged signal is received only once");
+ DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+
+ // Check that the field's font style has been altered
+ pointSizeValue = field.GetProperty(TextField::Property::POINT_SIZE);
+ pointSizeValue.Get( pointSize );
+
+ DALI_TEST_EQUALS( pointSize, 16.0f, 0.001, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+int UtcDaliStyleManagerStyleChangedSignalFontSizeTextEditor(void)
+{
+ tet_infoline("Test that the StyleChange signal is fired when the font size is altered" );
+
+ const char* defaultTheme =
+ "{\n"
+ " \"styles\":\n"
+ " {\n"
+ " \"texteditorFontSize0\":\n"
+ " {\n"
+ " \"pointSize\":10\n"
+ " },\n"
+ " \"texteditorFontSize1\":\n"
+ " {\n"
+ " \"pointSize\":12\n"
+ " },\n"
+ " \"texteditorFontSize2\":\n"
+ " {\n"
+ " \"pointSize\":14\n"
+ " },\n"
+ " \"texteditorFontSize3\":\n"
+ " {\n"
+ " \"pointSize\":18\n"
+ " },\n"
+ " \"texteditorFontSize4\":\n"
+ " {\n"
+ " \"pointSize\":25\n"
+ " }\n"
+ " }\n"
+ "}\n";
+
+ Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json", defaultTheme );
+
+ ToolkitTestApplication application;
+
+ std::string editorStr("Editor");
+ Toolkit::TextEditor editor = Toolkit::TextEditor::New();
+ editor.SetProperty( Toolkit::TextEditor::Property::TEXT, editorStr );
+ Stage::GetCurrent().Add( editor );
+
+ Toolkit::TextEditor editor2 = Toolkit::TextEditor::New();
+ Stage::GetCurrent().Add( editor2 );
+ editor2.SetProperty( Toolkit::TextEditor::Property::TEXT, editorStr );
+
+ StyleChangedSignalChecker styleChangedSignalHandler;
+ StyleMonitor styleMonitor = StyleMonitor::Get();
+ StyleManager styleManager = StyleManager::Get();
+
+ editor.SetProperty(TextEditor::Property::POINT_SIZE, 10.0f);
+
+ styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
+
+ Test::StyleMonitor::SetDefaultFontSize(2);
+ styleMonitor.StyleChangeSignal().Emit( styleMonitor, StyleChange::DEFAULT_FONT_SIZE_CHANGE);
+
+ tet_infoline("Test that the StyleChanged signal is received only once");
+ DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+
+ tet_infoline("Test that the editor's font size has been altered\n");
+ Property::Value pointSizeValue = editor.GetProperty(TextEditor::Property::POINT_SIZE);
+ float pointSize;
+ pointSizeValue.Get( pointSize );
+
+ DALI_TEST_EQUALS( pointSize, 14.0f, 0.001, TEST_LOCATION );
+
+ styleChangedSignalHandler.signalCount = 0;
+
+ Test::StyleMonitor::SetDefaultFontSize(4);
+ styleMonitor.StyleChangeSignal().Emit( styleMonitor, StyleChange::DEFAULT_FONT_SIZE_CHANGE);
+
+ tet_infoline("Test that the StyleChanged signal is received only once");
+ DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+
+ // Check that the editor's font style has been altered
+ pointSizeValue = editor.GetProperty(TextEditor::Property::POINT_SIZE);
+ pointSizeValue.Get( pointSize );
+
+ DALI_TEST_EQUALS( pointSize, 25.0f, 0.001, TEST_LOCATION );
+
+
END_TEST;
}
utc-Dali-KeyboardFocusManager.cpp
utc-Dali-Magnifier.cpp
utc-Dali-Popup.cpp
+ utc-Dali-ProgressBar.cpp
utc-Dali-PushButton.cpp
utc-Dali-RadioButton.cpp
utc-Dali-ScrollViewEffect.cpp
utc-Dali-Model3dView.cpp
utc-Dali-Visual.cpp
utc-Dali-VisualFactory.cpp
- utc-Dali-DebugVisual.cpp
+ utc-Dali-DebugRendering.cpp
utc-Dali-ImageAtlas.cpp
utc-Dali-VideoView.cpp
)
# Append list of test harness files (Won't get parsed for test cases)
LIST(APPEND TC_SOURCES
+ dali-toolkit-test-utils/toolkit-adaptor.cpp
dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
dali-toolkit-test-utils/toolkit-application.cpp
dali-toolkit-test-utils/toolkit-bitmap-loader.cpp
{
return CreateBufferImage(4, 4, Color::WHITE);
}
+
+namespace Test
+{
+
+struct ObjectDestructionFunctor
+{
+ // Create a ObjectDestructionFunctor passing in a Dali::RefObject* to be monitored and a bool variable.
+ // Create ObjectRegistry instance and connect to the ObjectDestroyedSignal passing in the above functor for the callback.
+ // Get the ObjectPointer (Actor::GetObjectPtr) of the Actor to be checked for destruction and assign it to the Dali::RefObject*
+ // Check the bool variable which would be true when object destroyed.
+ ObjectDestructionFunctor( Dali::RefObject* objectPtr, bool& refObjectDestroyed )
+ : refObjectPointerToCheck( objectPtr ),
+ refObjectDestroyedBoolean( refObjectDestroyed )
+ {
+ refObjectDestroyed = false;
+ }
+
+ void operator()( const Dali::RefObject* objectPointer )
+ {
+ if ( refObjectPointerToCheck == objectPointer )
+ {
+ refObjectDestroyedBoolean = true;
+ }
+ }
+
+ Dali::RefObject* refObjectPointerToCheck;
+ bool& refObjectDestroyedBoolean;
+};
+
+ObjectDestructionTracker::ObjectDestructionTracker()
+ :mRefObjectDestroyed( false)
+{
+}
+
+void ObjectDestructionTracker::Start( Actor actor )
+{
+ ObjectDestructionFunctor destructionFunctor( actor.GetObjectPtr(), mRefObjectDestroyed );
+
+ ObjectRegistry objectRegistry = Stage::GetCurrent().GetObjectRegistry();
+ objectRegistry.ObjectDestroyedSignal().Connect( this, destructionFunctor );
+}
+
+bool ObjectDestructionTracker::IsDestroyed()
+{
+ return mRefObjectDestroyed;
+}
+
+} // namespace Test
BufferImage CreateBufferImage();
BufferImage CreateBufferImage(int width, int height, const Vector4& color);
+// Test namespace to prevent pollution of Dali namespace, add Test helper functions here
+namespace Test
+{
+/**
+ * @brief
+ *
+ * Helper to check object destruction occurred
+ * 1) In main part of code create an ObjectDestructionTracker
+ * 2) Within sub section of main create object Actor test and call Start with Actor to test for destruction
+ * 3) Perform code which is expected to destroy Actor
+ * 4) Back in main part of code use IsDestroyed() to test if Actor was destroyed
+ */
+class ObjectDestructionTracker : public ConnectionTracker
+{
+public:
+
+ /**
+ * @brief
+ *
+ * Call in main part of code
+ */
+ ObjectDestructionTracker();
+
+ /**
+ * @brief Call in sub bock of code where the Actor being checked is still alive.
+ *
+ * @param[in] actor Actor to be checked for destruction
+ */
+ void Start( Actor actor );
+
+ /**
+ * @brief Call to check if Actor alive or destroyed.
+ * @return bool true if Actor was destroyed
+ */
+ bool IsDestroyed();
+
+private:
+ bool mRefObjectDestroyed;
+};
+
+} // namespace Test
+
#endif // __DALI_TEST_SUITE_UTILS_H__
// INTERNAL INCLUDES
-// dali-test-suite-utils.h needed first, but want to prevent certain headers
-// from being read, as we want to override as much of their behaviour as possible.
-#define __DALI_STYLE_MONITOR_H__
-#define __DALI_ACCESSIBILITY_MANAGER_H__
-#define __DALI_TIMER_H__
-#define __DALI_CLIPBOARD_H__
-#define __DALI_IMF_MANAGER_H__
-
#include <dali-test-suite-utils.h>
-
#include "toolkit-test-application.h"
#include "toolkit-application.h"
+#include "toolkit-imf-manager.h"
+#include "toolkit-clipboard-event-notifier.h"
#endif // __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
Control::UnregisterVisual( index );
}
+Toolkit::Visual::Base DummyControlImpl::GetVisual( Property::Index index )
+{
+ return Control::GetVisual( index );
+}
+
+Actor DummyControlImpl::GetPlacementActor( Property::Index index )
+{
+ return Control::GetPlacementActor( index );
+}
+
DummyControl DummyControlImplOverride::New()
{
IntrusivePtr< DummyControlImplOverride > impl = new DummyControlImplOverride;
void RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual);
void UnregisterVisual( Property::Index index );
+ Toolkit::Visual::Base GetVisual( Property::Index index );
+ Actor GetPlacementActor( Property::Index index );
// Used to test signal connections
void CustomSlot1( Actor actor );
return FindIndexFromMethodAndParams( method, params ) > -1;
}
+bool TraceCallStack::FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const
+{
+ for( size_t i = startIndex; i < mCallStack.size(); ++i )
+ {
+ if( ( mCallStack[i].method.compare( method ) == 0 ) && ( mCallStack[i].paramList.compare( params ) == 0 ) )
+ {
+ startIndex = i;
+ return true;
+ }
+ }
+ return false;
+}
/**
* Search for a method in the stack with the given parameter list
*/
bool FindMethodAndParams(std::string method, const NamedParams& params) const;
+ /**
+ * Search for a method in the stack with the given parameter list.
+ * The search is done from a given index.
+ * This allows the order of methods and parameters to be checked.
+ * @param[in] method The name of the method
+ * @param[in] params A comma separated list of parameter values
+ * @param[in/out] startIndex The method index to start looking from.
+ * This is updated if a method is found so subsequent
+ * calls can search for methods occuring after this one.
+ * @return True if the method was in the stack
+ */
+ bool FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const;
+
/**
* Search for a method in the stack with the given parameter list
* @param[in] method The name of the method
AccessibilityAdaptor::AccessibilityAdaptor()
: mIsEnabled(false),
+ mActionHandler(NULL),
+ mGestureHandler(NULL),
mReadPosition( 0.0f, 0.0f )
{
}
--- /dev/null
+#ifndef __DALI_TOOLKIT_ADAPTOR_IMPL_H__
+#define __DALI_TOOLKIT_ADAPTOR_IMPL_H__
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/devel-api/adaptor-framework/render-surface.h>
+
+namespace Dali
+{
+class EglInterface;
+class DisplayConnection;
+class ThreadSynchronizationInterface;
+
+namespace Integration
+{
+
+class GlAbstraction;
+
+} // namespace Integration
+
+class TestRenderSurface : public RenderSurface
+{
+public:
+ virtual PositionSize GetPositionSize() const { PositionSize size; return size; }
+
+ virtual void InitializeEgl( EglInterface& egl ) {}
+
+ virtual void CreateEglSurface( EglInterface& egl ) {}
+
+ virtual void DestroyEglSurface( EglInterface& egl ) {}
+
+ virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; }
+
+ virtual void MoveResize( Dali::PositionSize positionSize ) {}
+
+ virtual void SetViewMode( ViewMode viewMode ) {}
+
+ virtual void StartRender() {}
+
+ virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; }
+
+ virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {}
+
+ virtual void StopRender() {}
+
+ virtual void ReleaseLock() {}
+
+ virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
+
+ virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::ECORE_RENDER_SURFACE; }
+};
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+class Adaptor: public BaseObject
+{
+public:
+ static Dali::Adaptor& Get();
+ Adaptor();
+ ~Adaptor();
+
+public:
+ static Dali::RenderSurface& GetSurface();
+ static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
+ static bool mAvailable;
+ static Vector<CallbackBase*> mCallbacks;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_ADAPTOR_IMPL_H__
/*
- * Copyright (c) 2014 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/integration-api/adaptors/adaptor.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/devel-api/adaptor-framework/render-surface.h>
-namespace Dali
-{
-
-class EglInterface;
-class DisplayConnection;
-class ThreadSynchronizationInterface;
-
-namespace Integration
-{
+#include <toolkit-adaptor-impl.h>
-class GlAbstraction;
-
-} // namespace Integration
-
-class TestRenderSurface : public RenderSurface
+namespace Dali
{
-public:
- virtual PositionSize GetPositionSize() const { PositionSize size; return size; }
-
- virtual void InitializeEgl( EglInterface& egl ) {}
-
- virtual void CreateEglSurface( EglInterface& egl ) {}
-
- virtual void DestroyEglSurface( EglInterface& egl ) {}
-
- virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; }
-
- virtual void MoveResize( Dali::PositionSize positionSize ) {}
-
- virtual void SetViewMode( ViewMode viewMode ) {}
-
- virtual void StartRender() {}
-
- virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; }
-
- virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {}
-
- virtual void StopRender() {}
-
- virtual void ReleaseLock() {}
-
- virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
-
-};
namespace Internal
{
namespace Adaptor
{
-class Adaptor: public BaseObject
-{
-public:
- static Dali::Adaptor& Get();
- Adaptor();
- ~Adaptor();
-
-public:
- static Dali::RenderSurface& GetSurface();
- static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
-};
+bool Adaptor::mAvailable = false;
+Vector<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
Dali::Adaptor& Adaptor::Get()
{
Dali::Adaptor* adaptor = new Dali::Adaptor;
+ Adaptor::mAvailable = true;
return *adaptor;
}
return *signal;
}
-}
-}
-}
-
-namespace Dali
-{
+} // namespace Adaptor
+} // namespace Internal
Adaptor& Adaptor::New( Window window )
{
bool Adaptor::AddIdle( CallbackBase* callback )
{
- return false;
+ const bool isAvailable = IsAvailable();
+
+ if( isAvailable )
+ {
+ Internal::Adaptor::Adaptor::mCallbacks.PushBack( callback );
+ }
+
+ return isAvailable;
+}
+
+void Adaptor::RemoveIdle( CallbackBase* callback )
+{
+ const bool isAvailable = IsAvailable();
+
+ if( isAvailable )
+ {
+ for( Vector<CallbackBase*>::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(),
+ endIt = Internal::Adaptor::Adaptor::mCallbacks.End();
+ it != endIt;
+ ++it )
+ {
+ if( callback == *it )
+ {
+ Internal::Adaptor::Adaptor::mCallbacks.Remove( it );
+ return;
+ }
+ }
+ }
}
void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
bool Adaptor::IsAvailable()
{
- return false;
+ return Internal::Adaptor::Adaptor::mAvailable;
}
void Adaptor::NotifySceneCreated()
public:
+ static std::string GetResourcePath();
+
//Orientation& GetOrientation();
public: // static methods
//delete mOrientation;
}
+std::string Application::GetResourcePath()
+{
+ return "";
+}
//Orientation& Application::GetOrientation()
//{
// return *mOrientation;
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-object.h>
-
+#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
namespace Dali
{
bool SetItem(const std::string &itemData);
/**
- * @copydoc Dali::Clipboard::GetItem()
+ * @copydoc Dali::Clipboard::RequestItem()
*/
- std::string GetItem( unsigned int index );
+ void RequestItem();
/**
* @copydoc Dali::Clipboard::NumberOfClipboardItems()
*/
void HideClipboard();
+ /**
+ * @copydoc Dali::Clipboard::IsVisible()
+ */
+ bool IsVisible() const;
private:
Clipboard( const Clipboard& );
Clipboard& operator=( Clipboard& );
static Dali::Clipboard mToolkitClipboard;
+ bool mVisible;
+ std::string mItem;
+ int mCount;
}; // class clipboard
Dali::Clipboard Dali::Internal::Adaptor::Clipboard::mToolkitClipboard;
-Clipboard::Clipboard( /*Ecore_X_Window ecoreXwin*/)
+Clipboard::Clipboard()
{
+ mVisible = false;
+ mCount = 0;
}
Clipboard::~Clipboard()
bool Clipboard::SetItem(const std::string &itemData )
{
+ mItem = itemData;
+ mCount = 1;
return true;
}
-std::string Clipboard::GetItem( unsigned int index )
+void Clipboard::RequestItem()
{
- return "";
+ Dali::ClipboardEventNotifier clipboardEventNotifier(Dali::ClipboardEventNotifier::Get());
+ if ( clipboardEventNotifier )
+ {
+ clipboardEventNotifier.SetContent( mItem );
+ clipboardEventNotifier.EmitContentSelectedSignal();
+ }
}
unsigned int Clipboard::NumberOfItems()
{
- return 0;
+ return mCount;
}
void Clipboard::ShowClipboard()
{
+ mVisible = true;
}
void Clipboard::HideClipboard()
{
+ mVisible = false;
}
+bool Clipboard::IsVisible() const
+{
+ return mVisible;
+}
} // namespace Adaptor
return GetImplementation(*this).SetItem( itemData );
}
-std::string Clipboard::GetItem( unsigned int index )
+void Clipboard::RequestItem()
{
- return GetImplementation(*this).GetItem( index );
+ GetImplementation(*this).RequestItem();
}
unsigned int Clipboard::NumberOfItems()
GetImplementation(*this).HideClipboard();
}
+bool Clipboard::IsVisible() const
+{
+ return GetImplementation(*this).IsVisible();
+}
+
} // namespace Dali
bool SetItem( const std::string& itemData );
/**
- * Retreive the string at the given index in the clip board.
- * @param[in] index item in clipboard list to retrieve
- * @return string the text item at the current index.
+ * Request clipboard service to retrieve an item
*/
- std::string GetItem( unsigned int index );
+ void RequestItem();
/**
* Returns the number of item currently in the clipboard
*/
void HideClipboard();
+ /**
+ * @brief Retrieves the clipboard's visibility
+ * @return bool true if the clipboard is visible.
+ */
+ bool IsVisible() const;
+
};
} // namespace Dali
return Internal::Adaptor::ImfManager::GetImplementation(*this).GetSurroundingText();
}
+void ImfManager::NotifyTextInputMultiLine( bool multiLine )
+{
+}
+
ImfManager::ImfManagerSignalType& ImfManager::ActivatedSignal()
{
return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal();
*/
const std::string& GetSurroundingText() const;
+ /**
+ * @brief Notifies IMF context that text input is set to multi line or not
+ */
+ void NotifyTextInputMultiLine( bool multiLine );
+
public:
// Signals
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/signals/dali-signal.h>
-namespace Dali
-{
-const std::string Dali::StyleMonitor::DEFAULT_FONT_FAMILY("DefaultFont");
-const std::string Dali::StyleMonitor::DEFAULT_FONT_STYLE("Regular");
-const float Dali::StyleMonitor::DEFAULT_FONT_SIZE(1.0f);
-}
-
namespace
{
const char* DEFAULT_THEME=
NamedThemes gThemes;
std::string gTheme;
-std::string gFontFamily = Dali::StyleMonitor::DEFAULT_FONT_FAMILY;
-std::string gFontStyle = Dali::StyleMonitor::DEFAULT_FONT_STYLE;
-float gFontSize = Dali::StyleMonitor::DEFAULT_FONT_SIZE;
+std::string gFontFamily("LucidaSans");
+std::string gFontStyle("Regular");
+int gFontSize(1);
}
namespace Dali
float StyleMonitor::GetDefaultFontSize() const
{
return gFontSize;
-
}
const std::string& StyleMonitor::GetTheme() const
return GetImplementation(*this).GetDefaultFontStyle();
}
-float StyleMonitor::GetDefaultFontSize() const
+int StyleMonitor::GetDefaultFontSize() const
{
return GetImplementation(*this).GetDefaultFontSize();
}
return GetImplementation(*this).GetTheme();
}
-void StyleMonitor::SetTheme(std::string themeFilePath)
+void StyleMonitor::SetTheme(const std::string& themeFilePath)
{
GetImplementation(*this).SetTheme(themeFilePath);
}
return GetImplementation(*this).StyleChangeSignal();
}
-void StyleMonitor::EmitStyleChangeSignal(StyleChange::Type styleChange)
-{
- GetImplementation(*this).EmitStyleChangeSignal(styleChange);
-}
-
bool StyleMonitor::LoadThemeFile( const std::string& filename, std::string& output )
{
return GetImplementation(*this).LoadThemeFile(filename, output);
#include <string>
// INTERNAL INCLUDES
-#define __DALI_STYLE_MONITOR_H__
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/signals/dali-signal.h>
#include <dali/public-api/adaptor-framework/style-change.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-namespace Adaptor
-{
-class StyleMonitor;
-}
-}
-
-class StyleMonitor : public BaseHandle
-{
-public: // Typedefs
- typedef Signal< void (StyleMonitor, StyleChange::Type) > StyleChangeSignalType;
- static const std::string DEFAULT_FONT_FAMILY;
- static const std::string DEFAULT_FONT_STYLE;
- static const float DEFAULT_FONT_SIZE;
-
-public: // Creation & Destruction
- StyleMonitor();
- StyleMonitor(const StyleMonitor& monitor);
- static StyleMonitor Get();
- ~StyleMonitor();
- static StyleMonitor DownCast( BaseHandle handle );
-
-public: // Style Information
- std::string GetDefaultFontFamily() const;
- std::string GetDefaultFontStyle() const;
- float GetDefaultFontSize() const;
- const std::string& GetTheme() const;
- void SetTheme(std::string themeFilePath);
- bool LoadThemeFile( const std::string& filename, std::string& output );
-
-public: // Signals
- StyleChangeSignalType& StyleChangeSignal();
- void EmitStyleChangeSignal(StyleChange::Type handle);
-
-public: // Operators
- StyleMonitor& operator=(const StyleMonitor& monitor);
-
-public:
- StyleMonitor(Internal::Adaptor::StyleMonitor* styleMonitor);
-};
-
-
-} // namespace Dali
+#include <dali/devel-api/adaptor-framework/style-monitor.h>
namespace Test
{
#define __DALI_TOOLKIT_TEST_APPLICATION_H__
/*
- * Copyright (c) 2014 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.
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
#include <dali/devel-api/text-abstraction/font-client.h>
+#include <dali/integration-api/adaptors/adaptor.h>
+#include <toolkit-adaptor-impl.h>
namespace Dali
{
//return mOrientation;
//}
+ /**
+ * @brief Creates an adaptor implementation for those controls like the
+ * text-field and the text-editor which connects a callback to the idle signal.
+ */
+ void CreateAdaptor()
+ {
+ Adaptor::Get();
+ }
+
+ /**
+ * @brief Executes the idle callbacks.
+ *
+ * Some controls like the text-field and the text-editor connect callbacks to the
+ * idle signal.
+ */
+ void RunIdles()
+ {
+ if( Adaptor::IsAvailable() )
+ {
+ for( Vector<CallbackBase*>::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(),
+ endIt = Internal::Adaptor::Adaptor::mCallbacks.End();
+ it != endIt;
+ ++it )
+ {
+ CallbackBase* callback = *it;
+
+ CallbackBase::Execute( *callback );
+ }
+
+ Internal::Adaptor::Adaptor::mCallbacks.Clear();
+ }
+ }
+
private:
//ToolkitOrientation mOrientation;
};
void GetDescription( FontId id, FontDescription& fontDescription ){}
PointSize26Dot6 GetPointSize( FontId id ){return 9;}
FontId FindDefaultFont( Character charcode, PointSize26Dot6 pointSize, bool preferColor ){return 0;}
- FontId FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 pointSize, bool preferColor ){return 0;}
+ FontId FindFallbackFont( Character charcode, const FontDescription& fontDescription, PointSize26Dot6 pointSize, bool preferColor ){return 0;}
FontId GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex ){return 0;}
FontId GetFontId( const FontDescription& fontDescription,PointSize26Dot6 pointSize, FaceIndex faceIndex ){return 0;}
bool IsScalable( const FontPath& path ){return true;}
return GetImplementation(*this).FindDefaultFont( charcode, pointSize, preferColor );
}
-FontId FontClient::FindFallbackFont( FontId preferredFont, Character charcode, PointSize26Dot6 pointSize, bool preferColor )
+FontId FontClient::FindFallbackFont( Character charcode, const FontDescription& fontDescription, PointSize26Dot6 pointSize, bool preferColor )
{
- return GetImplementation(*this).FindFallbackFont( preferredFont, charcode, pointSize, preferColor );
+ return GetImplementation(*this).FindFallbackFont( charcode, fontDescription, pointSize, preferColor );
}
FontId FontClient::GetFontId( const FontPath& path, PointSize26Dot6 pointSize, FaceIndex faceIndex )
/*
- * 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.
namespace
{
-static bool gObjectCreatedCallBackCalled;
-
-static void TestCallback(BaseHandle handle)
-{
- gObjectCreatedCallBackCalled = true;
-}
-
// Functors to test whether focus changed signal is emitted when the focus is changed
class FocusChangedCallback : public Dali::ConnectionTracker
{
tet_infoline(" UtcDaliAccessibilityManagerGet");
- AccessibilityManager manager;
-
- //Ensure object is created by checking if it's registered
- ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
- DALI_TEST_CHECK(registry);
-
- gObjectCreatedCallBackCalled = false;
- registry.ObjectCreatedSignal().Connect( &TestCallback );
- {
- manager = AccessibilityManager::Get();
- DALI_TEST_CHECK(manager);
- }
- DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
AccessibilityManager newManager = AccessibilityManager::Get();
DALI_TEST_CHECK(newManager);
END_TEST;
}
+int UtcDaliAccessibilityManagerSetAndGetFocusIndicatorWithFocusedActor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliAccessibilityManagerSetAndGetFocusIndicatorWithFocusedActor");
+
+ AccessibilityManager manager = AccessibilityManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ Dali::AccessibilityAdaptor accAdaptor = Dali::AccessibilityAdaptor::Get();
+ Test::AccessibilityAdaptor::SetEnabled( accAdaptor, true );
+ accAdaptor.HandleActionEnableEvent();
+
+ Actor defaultFocusIndicatorActor = manager.GetFocusIndicatorActor();
+ DALI_TEST_CHECK(defaultFocusIndicatorActor);
+
+ Actor focusedActor = Actor::New();
+ Stage::GetCurrent().Add( focusedActor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( focusedActor.GetChildCount(), 0u, TEST_LOCATION );
+
+ manager.SetFocusOrder( focusedActor, 1 );
+ manager.SetCurrentFocusActor( focusedActor );
+
+ DALI_TEST_EQUALS( focusedActor.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_CHECK( focusedActor.GetChildAt(0) == defaultFocusIndicatorActor );
+
+ Actor newFocusIndicatorActor = Actor::New();
+ manager.SetFocusIndicatorActor( newFocusIndicatorActor );
+ DALI_TEST_CHECK(manager.GetFocusIndicatorActor() == newFocusIndicatorActor);
+ DALI_TEST_EQUALS( focusedActor.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_CHECK( focusedActor.GetChildAt(0) == newFocusIndicatorActor );
+
+ // Disable Accessibility
+ Test::AccessibilityAdaptor::SetEnabled( accAdaptor, false );
+ accAdaptor.HandleActionEnableEvent();
+
+ DALI_TEST_EQUALS( focusedActor.GetChildCount(), 0u, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliAccessibilityManagerSignalFocusChanged(void)
{
ToolkitTestApplication application;
END_TEST;
}
+
int UtcDaliAccessibilityManagerActionMoveToFirstSignalN(void)
{
ToolkitTestApplication application;
Property::Index index =1;
Actor placementActor = Actor::New();
+ DALI_TEST_CHECK( !dummyImpl.GetVisual( index ) );
+ DALI_TEST_CHECK( !dummyImpl.GetPlacementActor( index ) );
+
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Toolkit::Visual::Base visual;
// Register index with a color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
Property::Map newMap;
newMap[Visual::Property::TYPE] = Visual::COLOR;
// ReRegister with altered color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
tet_result(TET_PASS);
END_TEST;
// Register index with a color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
// ReRegister to self
dummyImpl.RegisterVisual( index, dummy, visual );
- tet_result(TET_PASS);
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == dummy );
END_TEST;
}
{
ToolkitTestApplication application;
- DummyControl dummy = DummyControl::New();
- DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
+ Test::ObjectDestructionTracker objectDestructionTracker;
- Property::Index index =1;
- Actor placementActor = Actor::New();
+ {
+ DummyControl dummy = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(dummy.GetImplementation());
+ objectDestructionTracker.Start( dummy );
- Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
- Toolkit::Visual::Base visual;
+ Property::Index index = 1;
+ Actor placementActor = Actor::New();
- Property::Map map;
- map[Visual::Property::TYPE] = Visual::COLOR;
- map[ColorVisual::Property::MIX_COLOR] = Color::RED;
+ Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
+ Toolkit::Visual::Base visual;
- visual = visualFactory.CreateVisual( map );
- DALI_TEST_CHECK(visual);
+ Property::Map map;
+ map[Visual::Property::TYPE] = Visual::COLOR;
+ map[ColorVisual::Property::MIX_COLOR] = Color::RED;
- // ReRegister to self
- dummyImpl.RegisterVisual( index, dummy, visual );
+ visual = visualFactory.CreateVisual( map );
+ DALI_TEST_CHECK(visual);
- tet_result(TET_PASS);
+ // Register to self
+ dummyImpl.RegisterVisual( index, dummy, visual );
+ DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), false, TEST_LOCATION ); // Control not destroyed yet
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == dummy );
+ }
+
+ DALI_TEST_EQUALS( objectDestructionTracker.IsDestroyed(), true, TEST_LOCATION ); // Should be destroyed
END_TEST;
}
-
int UtcDaliControlImplRegisterTwoVisuals(void)
{
ToolkitTestApplication application;
newMap[ColorVisual::Property::MIX_COLOR] = Color::BLUE;
secondVisual = visualFactory.CreateVisual( newMap );
+ DALI_TEST_CHECK( secondVisual );
// ReRegister with altered color visual
dummyImpl.RegisterVisual( index2, secondPlacementActor, secondVisual );
- tet_result(TET_PASS);
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index2 ) == secondVisual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index2 ) == secondPlacementActor );
END_TEST;
}
// Register index with a color visual
dummyImpl.RegisterVisual( index, placementActor, visual );
+ DALI_TEST_CHECK( dummyImpl.GetVisual( index ) == visual );
+ DALI_TEST_CHECK( dummyImpl.GetPlacementActor( index ) == placementActor );
+
// Unregister visual
dummyImpl.UnregisterVisual( index );
- tet_result(TET_PASS);
+ DALI_TEST_CHECK( !dummyImpl.GetVisual( index ) );
+ DALI_TEST_CHECK( !dummyImpl.GetPlacementActor( index ) );
END_TEST;
}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/geometry.h>
+
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <toolkit-environment-variable.h> // for setting environment variable: DALI_DEBUG_RENDERING
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+namespace
+{
+const char* TEST_IMAGE_FILE_NAME = "image_01.jpg";
+const char* TEST_NPATCH_FILE_NAME = "image_01.9.jpg";
+
+bool IsDebugVisual( Visual::Base& visual )
+{
+ bool isDebugVisualType = false;
+ bool isGeometryLineType = false;
+
+ Property::Map propertyMap;
+ visual.CreatePropertyMap( propertyMap );
+ Property::Value* typeValue = propertyMap.Find( Visual::Property::TYPE, Property::INTEGER );
+ if ( typeValue )
+ {
+ isDebugVisualType = ( typeValue->Get<int>() == Visual::WIREFRAME ); // Debug Rendering uses the WireframeVisual
+ }
+
+ Actor actor = Actor::New();
+ visual.SetOnStage( actor );
+ Geometry geometry = actor.GetRendererAt( 0 ).GetGeometry();
+ isGeometryLineType = ( geometry.GetType() == Geometry::LINES );
+
+ return isDebugVisualType && isGeometryLineType;
+}
+}
+
+void dali_debug_rendering_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_debug_rendering_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliDebugRenderingGetVisual1(void)
+{
+ EnvironmentVariable::SetTestingEnvironmentVariable(true);
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliDebugRenderingGetVisual1: Request visual with a Property::Map" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ // Test that color visual is replaced with debug visual
+ Property::Map propertyMap1;
+ propertyMap1.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap1.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ Visual::Base colorVisual = factory.CreateVisual(propertyMap1);
+ DALI_TEST_CHECK( colorVisual );
+ DALI_TEST_CHECK( IsDebugVisual( colorVisual ) );
+
+ // Test that border visual is replaced with debug visual
+ Property::Map propertyMap2;
+ propertyMap2.Insert(Visual::Property::TYPE, Visual::BORDER);
+ propertyMap2.Insert(BorderVisual::Property::COLOR, Color::BLUE);
+ propertyMap2.Insert(BorderVisual::Property::SIZE, 2.f);
+ Visual::Base borderVisual = factory.CreateVisual(propertyMap2);
+ DALI_TEST_CHECK( borderVisual );
+ DALI_TEST_CHECK( IsDebugVisual( borderVisual ) );
+
+ // Test that gradient visual is replaced with debug visual
+ Property::Map propertyMap3;
+ propertyMap3.Insert(Visual::Property::TYPE, Visual::GRADIENT);
+ Vector2 start(-1.f, -1.f);
+ Vector2 end(1.f, 1.f);
+ propertyMap3.Insert(GradientVisual::Property::START_POSITION, start);
+ propertyMap3.Insert(GradientVisual::Property::END_POSITION, end);
+ propertyMap3.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
+ Property::Array stopOffsets;
+ stopOffsets.PushBack( 0.2f );
+ stopOffsets.PushBack( 0.8f );
+ propertyMap3.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets);
+ Property::Array stopColors;
+ stopColors.PushBack( Color::RED );
+ stopColors.PushBack( Color::GREEN );
+ propertyMap3.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
+ Visual::Base gradientVisual = factory.CreateVisual(propertyMap3);
+ DALI_TEST_CHECK( gradientVisual );
+ DALI_TEST_CHECK( IsDebugVisual( gradientVisual ) );
+
+ // Test that image visual is replaced with debug visual
+ Property::Map propertyMap4;
+ propertyMap4.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap4.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ Visual::Base imageVisual = factory.CreateVisual( propertyMap4 );
+ DALI_TEST_CHECK( imageVisual );
+ DALI_TEST_CHECK( IsDebugVisual( imageVisual ) );
+
+ // Test that n patch visual is replaced with debug visual
+ Property::Map propertyMap5;
+ propertyMap5.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap5.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
+ Visual::Base nPatchVisual = factory.CreateVisual( propertyMap4 );
+ DALI_TEST_CHECK( nPatchVisual );
+ DALI_TEST_CHECK( IsDebugVisual( nPatchVisual ) );
+
+ EnvironmentVariable::SetTestingEnvironmentVariable(false);
+ END_TEST;
+}
+
+int UtcDaliDebugRenderingGetVisual2(void)
+{
+ EnvironmentVariable::SetTestingEnvironmentVariable(true);
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliDebugRenderingGetVisual2: Request visual with various parameters" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ // Test that color visual is replaced with debug visual
+ Dali::Property::Map map;
+ map[ Visual::Property::TYPE ] = Visual::COLOR;
+ map[ ColorVisual::Property::MIX_COLOR ] = Color::CYAN;
+
+ Visual::Base colorVisual = factory.CreateVisual( map);
+ DALI_TEST_CHECK( colorVisual );
+ DALI_TEST_CHECK( IsDebugVisual( colorVisual ) );
+
+ // Test that border visual is replaced with debug visual
+ map.Clear();
+ map[ Visual::Property::TYPE ] = Visual::BORDER;
+ map[ BorderVisual::Property::COLOR ] = Color::GREEN;
+ map[ BorderVisual::Property::SIZE ] = 2.f;
+ Visual::Base borderVisual = factory.CreateVisual( map );
+ DALI_TEST_CHECK( borderVisual );
+ DALI_TEST_CHECK( IsDebugVisual( borderVisual ) );
+
+ // Test that image visual is replaced with debug visual
+ Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
+ Visual::Base imageVisual = factory.CreateVisual( image );
+ DALI_TEST_CHECK( imageVisual );
+ DALI_TEST_CHECK( IsDebugVisual( imageVisual ) );
+
+ // Test that n patch visual is replaced with debug visual
+ Visual::Base nPatchVisual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() );
+ DALI_TEST_CHECK( nPatchVisual );
+ DALI_TEST_CHECK( IsDebugVisual( nPatchVisual ) );
+
+ EnvironmentVariable::SetTestingEnvironmentVariable(false);
+ END_TEST;
+}
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali/public-api/rendering/renderer.h>
-#include <dali/public-api/rendering/geometry.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-
-#include <toolkit-environment-variable.h> // for setting environment variable: DALI_DEBUG_RENDERING
-
-using namespace Dali;
-using namespace Dali::Toolkit;
-
-namespace
-{
-const char* TEST_IMAGE_FILE_NAME = "image_01.jpg";
-const char* TEST_NPATCH_FILE_NAME = "image_01.9.jpg";
-
-bool IsDebugVisual( Visual::Base& visual )
-{
- bool isDebugVisualType = false;
- bool isGeometryLineType = false;
-
- Property::Map propertyMap;
- visual.CreatePropertyMap( propertyMap );
- Property::Value* typeValue = propertyMap.Find( Visual::Property::TYPE, Property::INTEGER );
- if ( typeValue )
- {
- isDebugVisualType = ( typeValue->Get<int>() == Visual::DEBUG );
- }
-
- Actor actor = Actor::New();
- visual.SetOnStage( actor );
- Geometry geometry = actor.GetRendererAt( 0 ).GetGeometry();
- isGeometryLineType = ( geometry.GetType() == Geometry::LINES );
-
- return isDebugVisualType && isGeometryLineType;
-}
-}
-
-void dali_debug_renderer_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void dali_debug_renderer_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliDebugVisualGetVisual1(void)
-{
- EnvironmentVariable::SetTestingEnvironmentVariable(true);
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliDebugVisualGetVisual1: Request visual with a Property::Map" );
-
- VisualFactory factory = VisualFactory::Get();
- DALI_TEST_CHECK( factory );
-
- // Test that color visual is replaced with debug visual
- Property::Map propertyMap1;
- propertyMap1.Insert(Visual::Property::TYPE, Visual::COLOR);
- propertyMap1.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
- Visual::Base colorVisual = factory.CreateVisual(propertyMap1);
- DALI_TEST_CHECK( colorVisual );
- DALI_TEST_CHECK( IsDebugVisual( colorVisual ) );
-
- // Test that border visual is replaced with debug visual
- Property::Map propertyMap2;
- propertyMap2.Insert(Visual::Property::TYPE, Visual::BORDER);
- propertyMap2.Insert(BorderVisual::Property::COLOR, Color::BLUE);
- propertyMap2.Insert(BorderVisual::Property::SIZE, 2.f);
- Visual::Base borderVisual = factory.CreateVisual(propertyMap2);
- DALI_TEST_CHECK( borderVisual );
- DALI_TEST_CHECK( IsDebugVisual( borderVisual ) );
-
- // Test that gradient visual is replaced with debug visual
- Property::Map propertyMap3;
- propertyMap3.Insert(Visual::Property::TYPE, Visual::GRADIENT);
- Vector2 start(-1.f, -1.f);
- Vector2 end(1.f, 1.f);
- propertyMap3.Insert(GradientVisual::Property::START_POSITION, start);
- propertyMap3.Insert(GradientVisual::Property::END_POSITION, end);
- propertyMap3.Insert(GradientVisual::Property::SPREAD_METHOD, GradientVisual::SpreadMethod::REPEAT);
- Property::Array stopOffsets;
- stopOffsets.PushBack( 0.2f );
- stopOffsets.PushBack( 0.8f );
- propertyMap3.Insert(GradientVisual::Property::STOP_OFFSET, stopOffsets);
- Property::Array stopColors;
- stopColors.PushBack( Color::RED );
- stopColors.PushBack( Color::GREEN );
- propertyMap3.Insert(GradientVisual::Property::STOP_COLOR, stopColors);
- Visual::Base gradientVisual = factory.CreateVisual(propertyMap3);
- DALI_TEST_CHECK( gradientVisual );
- DALI_TEST_CHECK( IsDebugVisual( gradientVisual ) );
-
- // Test that image visual is replaced with debug visual
- Property::Map propertyMap4;
- propertyMap4.Insert( Visual::Property::TYPE, Visual::IMAGE );
- propertyMap4.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- Visual::Base imageVisual = factory.CreateVisual( propertyMap4 );
- DALI_TEST_CHECK( imageVisual );
- DALI_TEST_CHECK( IsDebugVisual( imageVisual ) );
-
- // Test that n patch visual is replaced with debug visual
- Property::Map propertyMap5;
- propertyMap5.Insert( Visual::Property::TYPE, Visual::IMAGE );
- propertyMap5.Insert( ImageVisual::Property::URL, TEST_NPATCH_FILE_NAME );
- Visual::Base nPatchVisual = factory.CreateVisual( propertyMap4 );
- DALI_TEST_CHECK( nPatchVisual );
- DALI_TEST_CHECK( IsDebugVisual( nPatchVisual ) );
-
- EnvironmentVariable::SetTestingEnvironmentVariable(false);
- END_TEST;
-}
-
-int UtcDaliDebugVisualGetVisual2(void)
-{
- EnvironmentVariable::SetTestingEnvironmentVariable(true);
- ToolkitTestApplication application;
- tet_infoline( "UtcDaliDebugVisualGetVisual2: Request visual with various parameters" );
-
- VisualFactory factory = VisualFactory::Get();
- DALI_TEST_CHECK( factory );
-
- // Test that color visual is replaced with debug visual
- Dali::Property::Map map;
- map[ Visual::Property::TYPE ] = Visual::COLOR;
- map[ ColorVisual::Property::MIX_COLOR ] = Color::CYAN;
-
- Visual::Base colorVisual = factory.CreateVisual( map);
- DALI_TEST_CHECK( colorVisual );
- DALI_TEST_CHECK( IsDebugVisual( colorVisual ) );
-
- // Test that border visual is replaced with debug visual
- map.Clear();
- map[ Visual::Property::TYPE ] = Visual::BORDER;
- map[ BorderVisual::Property::COLOR ] = Color::GREEN;
- map[ BorderVisual::Property::SIZE ] = 2.f;
- Visual::Base borderVisual = factory.CreateVisual( map );
- DALI_TEST_CHECK( borderVisual );
- DALI_TEST_CHECK( IsDebugVisual( borderVisual ) );
-
- // Test that image visual is replaced with debug visual
- Image image = ResourceImage::New(TEST_IMAGE_FILE_NAME);
- Visual::Base imageVisual = factory.CreateVisual( image );
- DALI_TEST_CHECK( imageVisual );
- DALI_TEST_CHECK( IsDebugVisual( imageVisual ) );
-
- // Test that n patch visual is replaced with debug visual
- Visual::Base nPatchVisual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() );
- DALI_TEST_CHECK( nPatchVisual );
- DALI_TEST_CHECK( IsDebugVisual( nPatchVisual ) );
-
- EnvironmentVariable::SetTestingEnvironmentVariable(false);
- END_TEST;
-}
/*
- * Copyright (c) 2014 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 <stdlib.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
using namespace Dali;
using namespace Dali::Toolkit;
int destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
int srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
- DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::ONE );
- DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
- DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
- DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE );
+ DALI_TEST_CHECK( srcFactorRgb == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE );
value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
DALI_TEST_CHECK( value.Get( enable ) );
static bool gObjectCreatedCallBackCalled;
static bool gOnLayoutActivatedCalled; ///< Whether the LayoutActivated signal was invoked.
+static bool gOnScrollUpdateCalled;
static void TestCallback(BaseHandle handle)
{
gOnLayoutActivatedCalled = true;
}
+static void OnScrollUpdate( const Vector2& position )
+{
+ gOnScrollUpdateCalled = true;
+}
+
// Generate a PanGestureEvent to send to Core
Integration::PanGestureEvent GeneratePan(
Gesture::State state,
END_TEST;
}
+
+int UtcDaliItemEnableDisableRefresh(void)
+{
+ ToolkitTestApplication application;
+ Dali::Stage stage = Dali::Stage::GetCurrent();
+
+ // Create the ItemView actor
+ TestItemFactory factory;
+ ItemView view = ItemView::New(factory);
+
+ // Create a grid layout and add it to ItemView
+ ItemLayoutPtr gridLayout = DefaultItemLayout::New( DefaultItemLayout::GRID );
+ view.AddLayout(*gridLayout);
+ stage.Add(view);
+
+ // Activate the grid layout so that the items will be created and added to ItemView
+ Vector3 stageSize(stage.GetSize());
+ view.ActivateLayout(0, stageSize, 0.5f);
+
+ //Connect to signal scroll updated
+ view.ScrollUpdatedSignal().Connect( &OnScrollUpdate );
+
+ Property::Map attributes;
+ view.DoAction("enableRefresh", attributes );
+ gOnScrollUpdateCalled = true;
+ view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
+ application.SendNotification();
+ application.Render(1000);
+ DALI_TEST_EQUALS( gOnScrollUpdateCalled, true, TEST_LOCATION );
+
+
+ view.DoAction("disableRefresh", attributes );
+ gOnScrollUpdateCalled = false;
+ view.SetProperty( ItemView::Property::LAYOUT_POSITION, 100.0f );
+ application.SendNotification();
+ application.Render(1000);
+
+ DALI_TEST_EQUALS( gOnScrollUpdateCalled, false, TEST_LOCATION );
+
+ END_TEST;
+}
namespace
{
-const char * TEST_OBJ_FILE_NAME = "Dino.obj";
-const char * TEST_MTL_FILE_NAME = "Dino.mtl";
-//const char * TEST_IMG_PATH = "";
+const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
+const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
+const char* TEST_RESOURCE_LOCATION = TEST_RESOURCE_DIR "/";
}
// Negative test case for a method
DALI_TEST_CHECK( val.Get( obj_file_name ) );
DALI_TEST_EQUALS( obj_file_name, TEST_MTL_FILE_NAME, TEST_LOCATION );
- //modelView.SetProperty( Model3dView::Property::MTL_URL, Dali::Property::Value( mtlUrl ) );
- //modelView.SetProperty( Model3dView::Property::IMAGES_URL, Dali::Property::Value( imagesUrl ) );
+ view.SetProperty( Model3dView::Property::IMAGES_URL, Dali::Property::Value( TEST_RESOURCE_LOCATION ) );
+ val = view.GetProperty( Model3dView::Property::IMAGES_URL );
+ DALI_TEST_CHECK( val.Get( obj_file_name ) );
+ DALI_TEST_EQUALS( obj_file_name, TEST_RESOURCE_LOCATION, TEST_LOCATION );
+
+ Stage::GetCurrent().Add(view);
END_TEST;
}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+using Dali::Toolkit::ProgressBar;
+
+
+void utc_dali_toolkit_progressbar_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_progressbar_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+static bool gObjectCreatedCallBackCalled;
+
+static void TestCallback(BaseHandle handle)
+{
+ gObjectCreatedCallBackCalled = true;
+}
+
+}
+
+int UtcDaliProgressBarNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliProgressBarNew");
+
+ // Create the ProgressBar actor
+ ProgressBar progressBar;
+
+ DALI_TEST_CHECK( !progressBar );
+
+ progressBar = ProgressBar::New();
+
+ DALI_TEST_CHECK( progressBar );
+
+ ProgressBar progressBar2(progressBar);
+
+ DALI_TEST_CHECK( progressBar2 == progressBar );
+
+ ProgressBar progressBar3;
+ progressBar3 = progressBar2;
+
+ DALI_TEST_CHECK( progressBar3 == progressBar2 );
+
+ //Additional check to ensure object is created by checking if it's registered
+ ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ DALI_TEST_CHECK( registry );
+
+ gObjectCreatedCallBackCalled = false;
+ registry.ObjectCreatedSignal().Connect( &TestCallback );
+ {
+ ProgressBar progressBar = ProgressBar::New();
+ }
+ DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
+ END_TEST;
+}
+
+int UtcDaliProgressBarDestructor(void)
+{
+ ToolkitTestApplication application;
+
+ ProgressBar* progressBar = new ProgressBar();
+ delete progressBar;
+
+ DALI_TEST_CHECK( true );
+ END_TEST;
+}
+
+int UtcDaliProgressBarDownCast(void)
+{
+ ToolkitTestApplication application;
+
+ Handle handle = ProgressBar::New();
+
+ ProgressBar progressBar = ProgressBar::DownCast( handle );
+
+ DALI_TEST_CHECK( progressBar == handle );
+ END_TEST;
+}
+
+static bool gProgressBarValueChangedCallBackCalled = false;
+
+static void OnProgressBarValueChanged( ProgressBar progressBar, float value )
+{
+ gProgressBarValueChangedCallBackCalled = true;
+}
+
+int UtcDaliProgressBarSignals(void)
+{
+ ToolkitTestApplication application; // Exceptions require ToolkitTestApplication
+ tet_infoline(" UtcDaliProgressBarSignals");
+
+ // Create the ProgressBar actor
+ ProgressBar progressBar = ProgressBar::New();
+ Stage::GetCurrent().Add( progressBar );
+ progressBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ progressBar.SetAnchorPoint(ParentOrigin::TOP_LEFT);
+ progressBar.SetSize( Vector2( Stage::GetCurrent().GetSize().x, 20.0f ) );
+ progressBar.SetPosition( 0.0f, 0.0f );
+
+ progressBar.ValueChangedSignal().Connect( &OnProgressBarValueChanged );
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.2f);
+
+ application.SendNotification();
+ application.Render();
+
+ //gProgressBarValueChangedCallBackCalled = false;
+
+ DALI_TEST_CHECK(gProgressBarValueChangedCallBackCalled);
+ END_TEST;
+}
+
+int UtcDaliProgressBarSetPropertyP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliProgressBarSetPropertyP" );
+
+ ProgressBar progressBar = ProgressBar::New();
+ progressBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ progressBar.SetAnchorPoint(ParentOrigin::TOP_LEFT);
+ progressBar.SetSize( Vector2( Stage::GetCurrent().GetSize().x, 20.0f ) );
+ progressBar.SetPosition( 0.0f, 0.0f );
+
+ Stage::GetCurrent().Add(progressBar);
+ application.SendNotification();
+ application.Render();
+
+ float val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.0f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.2f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.2f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.8f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.8f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.4f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.4f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.0f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 1.0f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 1.0f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, -1.0f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 1.0f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.9f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.9f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 1.1f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.9f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 2.0f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.9f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.0f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.9f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.9f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.09f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.09f, TEST_LOCATION);
+
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.1f);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.1f, TEST_LOCATION);
+
+ {
+ Property::Map map;
+ map["rendererType"] = "image";
+ map["size"] = Vector2(200, 200);
+ map["url"] = "track2.png";
+ progressBar.SetProperty(ProgressBar::Property::TRACK_VISUAL, map);
+ map["url"] = "progress2.png";
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VISUAL, map);
+
+ Property::Value value = progressBar.GetProperty(ProgressBar::Property::TRACK_VISUAL);
+ Property::Map* resultMap = value.GetMap();
+ DALI_TEST_CHECK( resultMap );
+ Property::Value* url = resultMap->Find("url");
+ DALI_TEST_CHECK( url ) ;
+ DALI_TEST_EQUALS( *url, "track2.png", TEST_LOCATION );
+
+ value = progressBar.GetProperty(ProgressBar::Property::PROGRESS_VISUAL);
+ resultMap = value.GetMap();
+ DALI_TEST_CHECK( resultMap );
+ url = resultMap->Find("url");
+ DALI_TEST_CHECK( url ) ;
+ DALI_TEST_EQUALS( *url, "progress2.png", TEST_LOCATION );
+
+ }
+
+ END_TEST;
+}
+
+int UtcDaliProgressBarSetPropertyP1(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliProgressBarSetPropertyP1" );
+
+ ProgressBar progressBar = ProgressBar::New();
+ progressBar.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ progressBar.SetAnchorPoint(ParentOrigin::TOP_LEFT);
+ progressBar.SetSize( Vector2( Stage::GetCurrent().GetSize().x, 20.0f ) );
+ progressBar.SetPosition( 0.0f, 0.0f );
+
+ Stage::GetCurrent().Add(progressBar);
+ application.SendNotification();
+ application.Render();
+
+ float val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, 0.0f, TEST_LOCATION);
+
+ // test to download a file of 100k in chunks
+ float lowerBound = 0, upperBound = 100, progressValue = 0, chunkValue = 0;
+
+ while( chunkValue <= upperBound )
+ {
+ progressValue = (chunkValue - lowerBound ) / ( upperBound - lowerBound );
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, progressValue);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, progressValue, TEST_LOCATION);
+ chunkValue = chunkValue + 10;
+ }
+
+ // test to download a file of 1000k in chunks
+ lowerBound = 0, upperBound = 1000, progressValue = 0, chunkValue = 0;
+
+ while( chunkValue <= upperBound )
+ {
+ progressValue = (chunkValue - lowerBound ) / ( upperBound - lowerBound );
+ progressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, progressValue);
+ val = progressBar.GetProperty<float>(ProgressBar::Property::PROGRESS_VALUE);
+ DALI_TEST_EQUALS(val, progressValue, TEST_LOCATION);
+ chunkValue = chunkValue + 100;
+ }
+
+ END_TEST;
+}
+
scrollView.ScrollTo( target2, 0.25f, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
scrollView.ScrollTo( target, 0.0f );
Wait(application, RENDER_DELAY_SCROLL);
scrollView.ScrollTo( target2, 0.25f, AlphaFunction::LINEAR, Dali::Toolkit::DirectionBiasLeft, Dali::Toolkit::DirectionBiasLeft );
Wait(application, RENDER_DELAY_SCROLL);
- DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), Vector2::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
scrollView.ScrollTo( target, 0.0f );
Wait(application, RENDER_DELAY_SCROLL);
#include <iostream>
#include <stdlib.h>
+#include <unistd.h>
+
#include <dali/public-api/rendering/renderer.h>
+#include <dali/devel-api/adaptor-framework/clipboard.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
const float SCROLL_THRESHOLD = 10.f;
const float SCROLL_SPEED = 300.f;
+const unsigned int DEFAULT_FONT_SIZE = 1152u;
+const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+
static bool gTextChangedCallBackCalled;
+static bool gInputStyleChangedCallbackCalled;
+static Dali::Toolkit::TextEditor::InputStyle::Mask gInputStyleMask;
+
+struct CallbackFunctor
+{
+ CallbackFunctor(bool* callbackFlag)
+ : mCallbackFlag( callbackFlag )
+ {
+ }
+
+ void operator()()
+ {
+ *mCallbackFlag = true;
+ }
+ bool* mCallbackFlag;
+};
static void TestTextChangedCallback( TextEditor control )
{
gTextChangedCallBackCalled = true;
}
+static void TestInputStyleChangedCallback( TextEditor control, TextEditor::InputStyle::Mask mask )
+{
+ tet_infoline(" TestInputStyleChangedCallback");
+
+ gInputStyleChangedCallbackCalled = true;
+ gInputStyleMask = mask;
+}
+
// Generate a TapGestureEvent to send to Core.
Integration::TapGestureEvent GenerateTap(
Gesture::State state,
// Check font properties.
editor.SetProperty( TextEditor::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::FONT_STYLE, "Setting font style" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("Setting font style"), TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Reset font style.
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, "" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+
// Check that the Alignment properties can be correctly set
editor.SetProperty( TextEditor::Property::HORIZONTAL_ALIGNMENT, "END" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::HORIZONTAL_ALIGNMENT ), "END", TEST_LOCATION );
// Check input font properties.
editor.SetProperty( TextEditor::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "Setting input font style" );
- DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), "Setting input font style", TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}", TEST_LOCATION );
editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Reset input font style.
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"slant\":\"roman\"}" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_FONT_STYLE ), std::string(""), TEST_LOCATION );
+
// Check the line spacing property
DALI_TEST_EQUALS( editor.GetProperty<float>( TextEditor::Property::LINE_SPACING ), 0.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
editor.SetProperty( TextEditor::Property::LINE_SPACING, 10.f );
Stage::GetCurrent().Add( editor );
- editor.TextChangedSignal().Connect(&TestTextChangedCallback);
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ editor.TextChangedSignal().Connect( &TestTextChangedCallback );
+ bool textChangedSignal = false;
+ editor.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
gTextChangedCallBackCalled = false;
editor.SetProperty( TextEditor::Property::TEXT, "ABC" );
DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_CHECK( textChangedSignal );
application.SendNotification();
END_TEST;
}
+int utcDaliTextEditorInputStyleChanged01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorInputStyleChanged01");
+
+ // The text-editor emits signals when the input style changes. These changes of style are
+ // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+ // can't be emitted during the size negotiation as the callbacks may update the UI.
+ // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
+ // This creates an implementation of the adaptor stub and a queue of idle callbacks.
+ application.CreateAdaptor();
+
+ // Load some fonts.
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+
+ editor.SetSize( 300.f, 50.f );
+ editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
+ editor.SetProperty( TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>" );
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ editor.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
+ bool inputStyleChangedSignal = false;
+ editor.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
+
+ Stage::GetCurrent().Add( editor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_FAMILY | TextEditor::InputStyle::POINT_SIZE ), TEST_LOCATION );
+
+ const std::string fontFamily = editor.GetProperty( TextEditor::Property::INPUT_FONT_FAMILY ).Get<std::string>();
+ DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
+
+ const float pointSize = editor.GetProperty( TextEditor::Property::INPUT_POINT_SIZE ).Get<float>();
+ DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::COLOR ), TEST_LOCATION );
+
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::COLOR | TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
+
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+
+ const std::string style = editor.GetProperty( TextEditor::Property::INPUT_FONT_STYLE ).Get<std::string>();
+ DALI_TEST_EQUALS( style, "{\"weight\":\"bold\"}", TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextEditor::InputStyle::FONT_STYLE ), TEST_LOCATION );
+
+ const std::string style = editor.GetProperty( TextEditor::Property::INPUT_FONT_STYLE ).Get<std::string>();
+ DALI_TEST_CHECK( style.empty() );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ END_TEST;
+}
+
+int utcDaliTextEditorInputStyleChanged02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorInputStyleChanged02");
+
+ // The text-editor emits signals when the input style changes. These changes of style are
+ // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+ // can't be emitted during the size negotiation as the callbacks may update the UI.
+ // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
+ // This creates an implementation of the adaptor stub and a queue of idle callbacks.
+ application.CreateAdaptor();
+
+ // Load some fonts.
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+
+ editor.SetSize( 300.f, 50.f );
+ editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
+ editor.SetProperty( TextEditor::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='blue'> l</color><color value='green'>lo</color> <font weight='bold'>world</font> demo</font>" );
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ editor.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
+ bool inputStyleChangedSignal = false;
+ editor.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
+
+ Stage::GetCurrent().Add( editor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextEditor::InputStyle::FONT_FAMILY |
+ TextEditor::InputStyle::POINT_SIZE |
+ TextEditor::InputStyle::COLOR ),
+ TEST_LOCATION );
+
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
+
+ const std::string fontFamily = editor.GetProperty( TextEditor::Property::INPUT_FONT_FAMILY ).Get<std::string>();
+ DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
+
+ const float pointSize = editor.GetProperty( TextEditor::Property::INPUT_POINT_SIZE ).Get<float>();
+ DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextEditor::InputStyle::COLOR ),
+ TEST_LOCATION );
+
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLUE, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextEditor::InputStyle::COLOR ),
+ TEST_LOCATION );
+
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ editor.SetProperty( TextEditor::Property::INPUT_COLOR, Color::YELLOW );
+
+ editor.SetProperty( TextEditor::Property::INPUT_FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ editor.SetProperty( TextEditor::Property::INPUT_POINT_SIZE, 20.f );
+ editor.SetProperty( TextEditor::Property::INPUT_LINE_SPACING, 5.f );
+
+ editor.SetProperty( TextEditor::Property::INPUT_UNDERLINE, "underline" );
+ editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "shadow" );
+ editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "emboss" );
+ editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "outline" );
+
+ application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextEditor::InputStyle::COLOR |
+ TextEditor::InputStyle::POINT_SIZE |
+ TextEditor::InputStyle::FONT_STYLE |
+ TextEditor::InputStyle::LINE_SPACING |
+ TextEditor::InputStyle::UNDERLINE |
+ TextEditor::InputStyle::SHADOW |
+ TextEditor::InputStyle::EMBOSS |
+ TextEditor::InputStyle::OUTLINE ),
+ TEST_LOCATION );
+
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextEditor::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ editor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVuSerif" );
+ editor.SetProperty( TextEditor::Property::FONT_STYLE, "{\"weight\":\"black\",\"width\":\"expanded\",\"slant\":\"oblique\"}" );
+
+ // Create a tap event to touch the text editor.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextEditor::InputStyle::COLOR |
+ TextEditor::InputStyle::POINT_SIZE |
+ TextEditor::InputStyle::FONT_STYLE ),
+ TEST_LOCATION );
+
+ const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::YELLOW, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ END_TEST;
+}
+
int utcDaliTextEditorEvent01(void)
{
ToolkitTestApplication application;
application.SendNotification();
application.Render();
+ // Send some taps and check text controller with clipboard window
+ Dali::Clipboard clipboard = Clipboard::Get();
+ clipboard.ShowClipboard();
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ clipboard.HideClipboard();
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
// Tap first to get the focus.
application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
#include <iostream>
#include <stdlib.h>
+#include <unistd.h>
+
#include <dali/public-api/rendering/renderer.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali/integration-api/events/long-press-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include "toolkit-clipboard.h"
using namespace Dali;
using namespace Toolkit;
const float SCROLL_THRESHOLD = 10.f;
const float SCROLL_SPEED = 300.f;
+const unsigned int DEFAULT_FONT_SIZE = 1152u;
+const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+
static bool gTextChangedCallBackCalled;
static bool gMaxCharactersCallBackCalled;
+static bool gInputStyleChangedCallbackCalled;
+static Dali::Toolkit::TextField::InputStyle::Mask gInputStyleMask;
static void LoadBitmapResource(TestPlatformAbstraction& platform, int width, int height)
{
return time;
}
+Dali::Integration::Point GetPointDownInside( Vector2& pos )
+{
+ Dali::Integration::Point point;
+ point.SetState( PointState::DOWN );
+ point.SetScreenPosition( pos );
+ return point;
+}
+
+Dali::Integration::Point GetPointUpInside( Vector2& pos )
+{
+ Dali::Integration::Point point;
+ point.SetState( PointState::UP );
+ point.SetScreenPosition( pos );
+ return point;
+}
+
+struct CallbackFunctor
+{
+ CallbackFunctor(bool* callbackFlag)
+ : mCallbackFlag( callbackFlag )
+ {
+ }
+
+ void operator()()
+ {
+ *mCallbackFlag = true;
+ }
+ bool* mCallbackFlag;
+};
static void TestTextChangedCallback( TextField control )
{
gMaxCharactersCallBackCalled = true;
}
+static void TestInputStyleChangedCallback( TextField control, TextField::InputStyle::Mask mask )
+{
+ tet_infoline(" TestInputStyleChangedCallback");
+
+ gInputStyleChangedCallbackCalled = true;
+ gInputStyleMask = mask;
+}
+
// Generate a TapGestureEvent to send to Core.
Integration::TapGestureEvent GenerateTap(
Gesture::State state,
// Check font properties.
field.SetProperty( TextField::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- field.SetProperty( TextField::Property::FONT_STYLE, "Setting font style" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("Setting font style"), TEST_LOCATION );
+ field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
field.SetProperty( TextField::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Reset font style.
+ field.SetProperty( TextField::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
+ field.SetProperty( TextField::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
+ field.SetProperty( TextField::Property::FONT_STYLE, "" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+
// Check that the MAX_LENGTH property can be correctly set
const int maxNumberOfCharacters = 20;
field.SetProperty( TextField::Property::MAX_LENGTH, maxNumberOfCharacters );
// Check input font properties.
field.SetProperty( TextField::Property::INPUT_FONT_FAMILY, "Setting input font family" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_FAMILY ), "Setting input font family", TEST_LOCATION );
- field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "Setting input font style" );
- DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "Setting input font style", TEST_LOCATION );
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}", TEST_LOCATION );
field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 12.f );
DALI_TEST_EQUALS( field.GetProperty<float>( TextField::Property::INPUT_POINT_SIZE ), 12.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Reset input font style.
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"slant\":\"roman\"}" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::INPUT_FONT_STYLE ), std::string(""), TEST_LOCATION );
+
// Check the underline property
field.SetProperty( TextField::Property::UNDERLINE, "Underline properties" );
DALI_TEST_EQUALS( field.GetProperty<std::string>( TextField::Property::UNDERLINE ), std::string("Underline properties"), TEST_LOCATION );
Stage::GetCurrent().Add( field );
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
field.TextChangedSignal().Connect(&TestTextChangedCallback);
+ bool textChangedSignal = false;
+ field.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
gTextChangedCallBackCalled = false;
field.SetProperty( TextField::Property::TEXT, "ABC" );
DALI_TEST_CHECK( gTextChangedCallBackCalled );
+ DALI_TEST_CHECK( textChangedSignal );
application.SendNotification();
Stage::GetCurrent().Add( field );
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
field.TextChangedSignal().Connect(&TestTextChangedCallback);
+ bool textChangedSignal = false;
+ field.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) );
gTextChangedCallBackCalled = false;
field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "ABC" ); // Setting placeholder, not TEXT
DALI_TEST_CHECK( !gTextChangedCallBackCalled );
+ DALI_TEST_CHECK( !textChangedSignal );
END_TEST;
}
field.SetKeyInputFocus();
- gMaxCharactersCallBackCalled = false;
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
+ bool maxLengthReachedSignal = false;
+ field.ConnectSignal( testTracker, "maxLengthReached", CallbackFunctor(&maxLengthReachedSignal) );
+
+ gMaxCharactersCallBackCalled = false;
application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
DALI_TEST_CHECK( gMaxCharactersCallBackCalled );
+ DALI_TEST_CHECK( maxLengthReachedSignal );
END_TEST;
}
field.SetKeyInputFocus();
- gMaxCharactersCallBackCalled = false;
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
field.MaxLengthReachedSignal().Connect(&TestMaxLengthReachedCallback);
+ bool maxLengthReachedSignal = false;
+ field.ConnectSignal( testTracker, "maxLengthReached", CallbackFunctor(&maxLengthReachedSignal) );
+
+ gMaxCharactersCallBackCalled = false;
application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
application.ProcessEvent( GenerateKey( "a", "a", 0, 0, 0, Integration::KeyEvent::Down ) );
DALI_TEST_CHECK( !gMaxCharactersCallBackCalled );
+ DALI_TEST_CHECK( !maxLengthReachedSignal );
+
+ END_TEST;
+}
+
+int utcDaliTextFieldInputStyleChanged01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldInputStyleChanged01");
+
+ // The text-field emits signals when the input style changes. These changes of style are
+ // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+ // can't be emitted during the size negotiation as the callbacks may update the UI.
+ // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
+ // This creates an implementation of the adaptor stub and a queue of idle callbacks.
+ application.CreateAdaptor();
+
+ // Load some fonts.
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+ field.SetProperty( TextField::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='green'>llo</color> <font weight='bold'>world</font> demo</font>" );
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ field.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
+ bool inputStyleChangedSignal = false;
+ field.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
+
+ Stage::GetCurrent().Add( field );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 18.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::FONT_FAMILY | TextField::InputStyle::POINT_SIZE ), TEST_LOCATION );
+
+ const std::string fontFamily = field.GetProperty( TextField::Property::INPUT_FONT_FAMILY ).Get<std::string>();
+ DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
+
+ const float pointSize = field.GetProperty( TextField::Property::INPUT_POINT_SIZE ).Get<float>();
+ DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 30.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 43.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::COLOR ), TEST_LOCATION );
+
+ const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 88.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::COLOR | TextField::InputStyle::FONT_STYLE ), TEST_LOCATION );
+
+ const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+
+ const std::string style = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<std::string>();
+ DALI_TEST_EQUALS( style, "{\"weight\":\"bold\"}", TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 115.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 164.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ), static_cast<unsigned int>( TextField::InputStyle::FONT_STYLE ), TEST_LOCATION );
+
+ const std::string style = field.GetProperty( TextField::Property::INPUT_FONT_STYLE ).Get<std::string>();
+ DALI_TEST_CHECK( style.empty() );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 191.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ END_TEST;
+}
+
+int utcDaliTextFieldInputStyleChanged02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextFieldInputStyleChanged02");
+
+ // The text-field emits signals when the input style changes. These changes of style are
+ // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+ // can't be emitted during the size negotiation as the callbacks may update the UI.
+ // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
+ // This creates an implementation of the adaptor stub and a queue of idle callbacks.
+ application.CreateAdaptor();
+
+ // Load some fonts.
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
+
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif.ttf", DEFAULT_FONT_SIZE );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSerif-Bold.ttf", DEFAULT_FONT_SIZE );
+
+ TextField field = TextField::New();
+ DALI_TEST_CHECK( field );
+
+
+ field.SetSize( 300.f, 50.f );
+ field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ field.SetProperty( TextField::Property::ENABLE_MARKUP, true );
+ field.SetProperty( TextField::Property::TEXT, "<font family='DejaVuSerif' size='18'>He<color value='blue'> l</color><color value='green'>lo</color> <font weight='bold'>world</font> demo</font>" );
+
+ // connect to the text changed signal.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ field.InputStyleChangedSignal().Connect( &TestInputStyleChangedCallback );
+ bool inputStyleChangedSignal = false;
+ field.ConnectSignal( testTracker, "inputStyleChanged", CallbackFunctor(&inputStyleChangedSignal) );
+
+ Stage::GetCurrent().Add( field );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 53.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 53.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 2u, 1u, Vector2( 53.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextField::InputStyle::FONT_FAMILY |
+ TextField::InputStyle::POINT_SIZE |
+ TextField::InputStyle::COLOR ),
+ TEST_LOCATION );
+
+ const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::GREEN, TEST_LOCATION );
+
+ const std::string fontFamily = field.GetProperty( TextField::Property::INPUT_FONT_FAMILY ).Get<std::string>();
+ DALI_TEST_EQUALS( fontFamily, "DejaVuSerif", TEST_LOCATION );
+
+ const float pointSize = field.GetProperty( TextField::Property::INPUT_POINT_SIZE ).Get<float>();
+ DALI_TEST_EQUALS( pointSize, 18.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextField::InputStyle::COLOR ),
+ TEST_LOCATION );
+
+ const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLUE, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextField::InputStyle::COLOR ),
+ TEST_LOCATION );
+
+ const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
+
+ gInputStyleChangedCallbackCalled = false;
+ gInputStyleMask = TextField::InputStyle::NONE;
+ inputStyleChangedSignal = false;
+
+ field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
+
+ field.SetProperty( TextField::Property::INPUT_FONT_STYLE, "{\"weight\":\"thin\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ field.SetProperty( TextField::Property::INPUT_POINT_SIZE, 20.f );
+
+ field.SetProperty( TextField::Property::INPUT_UNDERLINE, "underline" );
+ field.SetProperty( TextField::Property::INPUT_SHADOW, "shadow" );
+ field.SetProperty( TextField::Property::INPUT_EMBOSS, "emboss" );
+ field.SetProperty( TextField::Property::INPUT_OUTLINE, "outline" );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( !gInputStyleChangedCallbackCalled );
+ DALI_TEST_CHECK( !inputStyleChangedSignal );
+
+ // Create a tap event to touch the text field.
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 63.f, 25.f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Executes the idle callbacks added by the text control on the change of input style.
+ application.RunIdles();
+
+ DALI_TEST_CHECK( gInputStyleChangedCallbackCalled );
+ if( gInputStyleChangedCallbackCalled )
+ {
+ DALI_TEST_EQUALS( static_cast<unsigned int>( gInputStyleMask ),
+ static_cast<unsigned int>( TextField::InputStyle::COLOR |
+ TextField::InputStyle::POINT_SIZE |
+ TextField::InputStyle::FONT_STYLE |
+ TextField::InputStyle::UNDERLINE |
+ TextField::InputStyle::SHADOW |
+ TextField::InputStyle::EMBOSS |
+ TextField::InputStyle::OUTLINE ),
+ TEST_LOCATION );
+
+ const Vector4 color = field.GetProperty( TextField::Property::INPUT_COLOR ).Get<Vector4>();
+ DALI_TEST_EQUALS( color, Color::BLACK, TEST_LOCATION );
+ }
+ DALI_TEST_CHECK( inputStyleChangedSignal );
END_TEST;
}
ToolkitTestApplication application;
tet_infoline(" utcDaliTextFieldEvent08");
+ Dali::Clipboard clipboard = Clipboard::Get();
+ clipboard.SetItem("testTextFieldEvent");
+
// Checks Longpress when only place holder text
TextField field = TextField::New();
application.SendNotification();
application.Render();
+ Wait(application, 500);
+
+ Stage stage = Stage::GetCurrent();
+ Layer layer = stage.GetRootLayer();
+ Actor actor = layer.FindChildByName("optionPaste");
+
+ if (actor)
+ {
+ Vector3 worldPosition = actor.GetCurrentWorldPosition();
+ Vector2 halfStageSize = stage.GetSize() / 2.0f;
+ Vector2 position(worldPosition.x + halfStageSize.width, worldPosition.y + halfStageSize.height);
+
+ Dali::Integration::TouchEvent event;
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( GetPointDownInside( position ) );
+ application.ProcessEvent( event );
+
+ event = Dali::Integration::TouchEvent();
+ event.AddPoint( GetPointUpInside( position ) );
+ application.ProcessEvent( event );
+ }
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( TextEditor::Property::TEXT ), std::string("testTextFieldEvent"), TEST_LOCATION );
END_TEST;
}
-int utcDaliTextFieldStyleWhilstSelected09(void)
+int utcDaliTextFieldStyleWhilstSelected(void)
{
ToolkitTestApplication application;
- tet_infoline(" utcDaliTextFieldEvent09");
+ tet_infoline(" utcDaliTextFieldStyleWhilstSelected");
// Change font and styles whilst text is selected whilst word selected
/*
- * Copyright (c) 2014 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.
// Check font properties.
label.SetProperty( TextLabel::Property::FONT_FAMILY, "Setting font family" );
DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_FAMILY ), std::string("Setting font family"), TEST_LOCATION );
- label.SetProperty( TextLabel::Property::FONT_STYLE, "Setting font style" );
- DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("Setting font style"), TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"weight\":\"bold\",\"width\":\"condensed\",\"slant\":\"italic\"}"), TEST_LOCATION );
label.SetProperty( TextLabel::Property::POINT_SIZE, 10.f );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::POINT_SIZE ), 10.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Reset font style.
+ label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"weight\":\"normal\",\"slant\":\"oblique\"}" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"weight\":\"normal\",\"slant\":\"oblique\"}"), TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::FONT_STYLE, "{\"slant\":\"roman\"}" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string("{\"slant\":\"normal\"}"), TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::FONT_STYLE, "" );
+ DALI_TEST_EQUALS( label.GetProperty<std::string>( TextLabel::Property::FONT_STYLE ), std::string(""), TEST_LOCATION );
+
// Toggle multi-line
label.SetProperty( TextLabel::Property::MULTI_LINE, true );
DALI_TEST_EQUALS( label.GetProperty<bool>( TextLabel::Property::MULTI_LINE ), true, TEST_LOCATION );
// Batch Image visual
propertyMap.Clear();
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
batchImageVisual.SetSize( visualSize );
DALI_TEST_EQUALS( batchImageVisual.GetSize(), visualSize, TEST_LOCATION );
propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 30 );
propertyMap.Insert( ImageVisual::Property::FITTING_MODE, FittingMode::FIT_HEIGHT );
propertyMap.Insert( ImageVisual::Property::SAMPLING_MODE, SamplingMode::BOX_THEN_NEAREST );
+ propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, Vector4( 0.25f, 0.25f, 0.5f, 0.5f ) );
+ propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::REPEAT );
+ propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::MIRRORED_REPEAT );
propertyMap.Insert( "synchronousLoading", true );
Visual::Base imageVisual = factory.CreateVisual(propertyMap);
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 30 );
+ value = resultMap.Find( ImageVisual::Property::PIXEL_AREA, Property::VECTOR4 );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<Vector4>(), Vector4( 0.25f, 0.25f, 0.5f, 0.5f ), Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ value = resultMap.Find( ImageVisual::Property::WRAP_MODE_U, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == WrapMode::REPEAT);
+
+ value = resultMap.Find( ImageVisual::Property::WRAP_MODE_V, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == WrapMode::MIRRORED_REPEAT);
+
value = resultMap.Find( "synchronousLoading", Property::BOOLEAN );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() == true );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 200 );
+ value = resultMap.Find( ImageVisual::Property::PIXEL_AREA, Property::VECTOR4 );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_EQUALS( value->Get<Vector4>(), Vector4( 0.f, 0.f, 1.f, 1.f ), Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ value = resultMap.Find( ImageVisual::Property::WRAP_MODE_U, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == WrapMode::DEFAULT);
+
+ value = resultMap.Find( ImageVisual::Property::WRAP_MODE_V, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == WrapMode::DEFAULT);
+
value = resultMap.Find( "synchronousLoading", Property::BOOLEAN );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() == false );
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, color );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, color );
propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<int>(), (int)PrimitiveVisual::Shape::CUBE, TEST_LOCATION );
- value = resultMap.Find( PrimitiveVisual::Property::COLOR, Property::VECTOR4 );
+ value = resultMap.Find( PrimitiveVisual::Property::MIX_COLOR, Property::VECTOR4 );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<Vector4>() == color );
DALI_TEST_EQUALS( value->Get<Vector4>(), color, Math::MACHINE_EPSILON_100, TEST_LOCATION );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_WIDTH, 20 );
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_HEIGHT, 30 );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 20 );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 30 );
Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( batchImageVisual );
// Check the property values from the returned map from visual
Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == Visual::BATCH_IMAGE );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::IMAGE );
- value = resultMap.Find( BatchImageVisual::Property::URL, Property::STRING );
+ value = resultMap.Find( ImageVisual::Property::URL, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_IMAGE_FILE_NAME );
- value = resultMap.Find( BatchImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_WIDTH, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 20 );
- value = resultMap.Find( BatchImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
+ value = resultMap.Find( ImageVisual::Property::DESIRED_HEIGHT, Property::INTEGER );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 30 );
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
// Set the desired size to be larger than the atlas limit of 1024x1024.
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_WIDTH, 2048 );
- propertyMap.Insert( BatchImageVisual::Property::DESIRED_HEIGHT, 2048 );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, 2048 );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, 2048 );
// Create the visual.
Visual::Base batchImageVisual = factory.CreateVisual( propertyMap );
END_TEST;
}
+
+int UtcDaliVisualAnimateBorderVisual01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimateBorderVisual Color" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
+ propertyMap.Insert(BorderVisual::Property::COLOR, Color::BLUE);
+ propertyMap.Insert(BorderVisual::Property::SIZE, 5.f);
+ Visual::Base borderVisual = factory.CreateVisual( propertyMap );
+
+ Actor actor = Actor::New();
+ actor.SetSize(2000, 2000);
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ Stage::GetCurrent().Add(actor);
+ borderVisual.SetOnStage( actor );
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index index = renderer.GetPropertyIndex( BorderVisual::Property::COLOR );
+
+ Animation animation = Animation::New(4.0f);
+ animation.AnimateTo( Property(renderer, index), Color::WHITE );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(2000u); // halfway point between blue and white
+
+ Vector4 color = renderer.GetProperty<Vector4>( index );
+ Vector4 testColor = (Color::BLUE + Color::WHITE)*0.5f;
+ DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", testColor ), true, TEST_LOCATION );
+
+ application.Render(2000u); // halfway point between blue and white
+
+ color = renderer.GetProperty<Vector4>( index );
+ DALI_TEST_EQUALS( color, Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("borderColor", Color::WHITE ), true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliVisualAnimateBorderVisual02(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimateBorderVisual Size" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::BORDER);
+ propertyMap.Insert(BorderVisual::Property::COLOR, Color::BLUE);
+ propertyMap.Insert(BorderVisual::Property::SIZE, 5.f);
+ Visual::Base borderVisual = factory.CreateVisual( propertyMap );
+
+ Actor actor = Actor::New();
+ actor.SetSize(2000, 2000);
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ Stage::GetCurrent().Add(actor);
+ borderVisual.SetOnStage( actor );
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index index = renderer.GetPropertyIndex( BorderVisual::Property::SIZE );
+
+ Animation animation = Animation::New(4.0f);
+ animation.AnimateTo( Property(renderer, index), 9.0f );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(2000u); // halfway point
+
+ float size = renderer.GetProperty<float>( index );
+ DALI_TEST_EQUALS( size, 7.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("borderSize", 7.0f ), true, TEST_LOCATION );
+
+ application.Render(2000u); // halfway point between blue and white
+
+ size = renderer.GetProperty<float>( index );
+ DALI_TEST_EQUALS( size, 9.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<float>("borderSize", 9.0f ), true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliVisualAnimateColorVisual(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimateColorVisual mixColor" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ Visual::Base borderVisual = factory.CreateVisual( propertyMap );
+
+ Actor actor = Actor::New();
+ actor.SetSize(2000, 2000);
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ Stage::GetCurrent().Add(actor);
+ borderVisual.SetOnStage( actor );
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index index = renderer.GetPropertyIndex( ColorVisual::Property::MIX_COLOR );
+
+ Animation animation = Animation::New(4.0f);
+ animation.AnimateTo( Property(renderer, index), Color::WHITE );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(2000u); // halfway point
+
+ Vector4 color = renderer.GetProperty<Vector4>( index );
+ Vector4 testColor = (Color::BLUE + Color::WHITE)*0.5f;
+ DALI_TEST_EQUALS( color, testColor, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", testColor ), true, TEST_LOCATION );
+
+ application.Render(2000u); // halfway point between blue and white
+
+ color = renderer.GetProperty<Vector4>( index );
+ DALI_TEST_EQUALS( color, Color::WHITE, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("mixColor", Color::WHITE ), true, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+
+int UtcDaliVisualAnimatePrimitiveVisual(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimatePrimitiveVisual color" );
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::COLOR);
+ propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
+ Visual::Base borderVisual = factory.CreateVisual( propertyMap );
+
+ Actor actor = Actor::New();
+ actor.SetSize(2000, 2000);
+ actor.SetParentOrigin(ParentOrigin::CENTER);
+ actor.SetColor(Color::BLACK);
+ Stage::GetCurrent().Add(actor);
+ borderVisual.SetOnStage( actor );
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION);
+
+ Renderer renderer = actor.GetRendererAt(0);
+ Property::Index index = renderer.GetPropertyIndex( PrimitiveVisual::Property::MIX_COLOR );
+
+ // The property isn't registered on the renderer, it's instead registered on the shader.
+ DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION );
+
+ Animation animation = Animation::New(4.0f);
+ animation.AnimateTo( Property(actor, Actor::Property::COLOR), Color::WHITE );
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(0);
+ application.Render(2000u); // halfway point
+
+ // Actor color overrides renderer color.
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Vector4(0.5f, 0.5f, 0.5f, 1.0f )), true, TEST_LOCATION );
+
+ application.Render(2000u); // halfway point between blue and white
+
+ DALI_TEST_EQUALS( actor.GetCurrentColor(), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS( application.GetGlAbstraction().CheckUniformValue<Vector4>("uColor", Color::WHITE ), true, TEST_LOCATION );
+
+
+ END_TEST;
+}
+
+int UtcDaliVisualWireframeVisual(void)
+{
+ ToolkitTestApplication application;
+
+ VisualFactory factory = VisualFactory::Get();
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::WIREFRAME );
+
+ // Create the visual.
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+
+ DALI_TEST_CHECK( visual );
+
+ Property::Map resultMap;
+ visual.CreatePropertyMap( resultMap );
+
+ // Check the property values from the returned map from visual
+ Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
+ DALI_TEST_CHECK( value );
+ DALI_TEST_CHECK( value->Get<int>() == Visual::WIREFRAME );
+ END_TEST;
+}
#include <iostream>
#include <stdlib.h>
#include <dali-toolkit-test-suite-utils.h>
+#include <toolkit-bitmap-loader.h>
#include <toolkit-event-thread-callback.h>
#include <dali/public-api/rendering/renderer.h>
#include <dali/public-api/rendering/texture-set.h>
#include <dali/public-api/rendering/shader.h>
+#include <dali/devel-api/images/nine-patch-image.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/dali-toolkit.h>
const char* TEST_IMAGE_FILE_NAME = "gallery_image_01.jpg";
const char* TEST_NPATCH_FILE_NAME = "gallery_image_01.9.png";
-
const char* TEST_SVG_FILE_NAME = TEST_RESOURCE_DIR "/svg1.svg";
const char* TEST_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube.obj";
const char* TEST_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal.mtl";
const char* TEST_SIMPLE_OBJ_FILE_NAME = TEST_RESOURCE_DIR "/Cube-Points-Only.obj";
const char* TEST_SIMPLE_MTL_FILE_NAME = TEST_RESOURCE_DIR "/ToyRobot-Metal-Simple.mtl";
+// resolution: 34*34, pixel format: RGBA8888
+static const char* gImage_34_RGBA = TEST_RESOURCE_DIR "/icon-edit.png";
+// resolution: 600*600, pixel format: RGB888
+static const char* gImage_600_RGB = TEST_RESOURCE_DIR "/test-image-600.jpg";
+
Integration::Bitmap* CreateBitmap( unsigned int imageWidth, unsigned int imageHeight, unsigned int initialColor, Pixel::Format pixelFormat )
{
Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
VisualFactory newFactory = VisualFactory::Get();
DALI_TEST_CHECK( newFactory );
- // Check that renderer factory is a singleton
+ // Check that visual factory is a singleton
DALI_TEST_CHECK(factory == newFactory);
END_TEST;
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
- DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<BlendMode::Type>(blendMode), BlendMode::ON, TEST_LOCATION );
TestGlAbstraction& gl = application.GetGlAbstraction();
application.Render(0);
int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
- DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::AUTO, TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<BlendMode::Type>(blendMode), BlendMode::AUTO, TEST_LOCATION );
Vector4 actualColor(Vector4::ZERO);
DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "borderColor", actualColor ) );
application.SendNotification();
application.Render(0);
blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
- DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<BlendMode::Type>(blendMode), BlendMode::ON, TEST_LOCATION );
END_TEST;
}
int UtcDaliVisualFactoryGetImageVisual1(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetImageVisual1: Request image renderer with a Property::Map" );
+ tet_infoline( "UtcDaliVisualFactoryGetImageVisual1: Request image visual with a Property::Map" );
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
int UtcDaliVisualFactoryGetImageVisual2(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetImageVisual2: Request image renderer with an image handle" );
+ tet_infoline( "UtcDaliVisualFactoryGetImageVisual2: Request image visual with an image handle" );
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
END_TEST;
}
+int UtcDaliVisualFactoryGetImageVisual3(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualFactoryGetImageVisual3: Request image visual with a Property::Map, test custom wrap mode and pixel area with atlasing" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ // Test wrap mode with atlasing. Image with a size smaller than 512*512 will be uploaded as a part of the atlas.
+ const int width=34;
+ const int height=34;
+ const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
+
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, gImage_34_RGBA );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
+ propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
+ propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
+ propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
+ propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
+
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ Actor actor = Actor::New();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+ TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
+ texParameterTrace.Enable( true );
+
+ actor.SetSize( 200.f, 200.f );
+ Stage::GetCurrent().Add( actor );
+ visual.SetOnStage( actor );
+
+ // loading started
+ application.SendNotification();
+ application.Render();
+ application.Render();
+ application.SendNotification();
+ BitmapLoader loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( loader );
+ loader.WaitForLoading();// waiting until the image to be loaded
+ DALI_TEST_CHECK( loader.IsLoaded() );
+
+ DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+
+ // WITH atlasing, the wrapping is handled manually in shader, so the following gl function should not be called
+ std::stringstream out;
+ out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
+ DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+ out.str("");
+ out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
+ DALI_TEST_CHECK( !texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+
+ // test the uniforms which used to handle the wrap mode
+ Renderer renderer = actor.GetRendererAt( 0u );
+ DALI_TEST_CHECK( renderer );
+
+ Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
+ DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
+ Vector4 pixelAreaUniform;
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
+ DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ Property::Value wrapModeValue = renderer.GetProperty( renderer.GetPropertyIndex( "wrapMode" ) );
+ Vector2 wrapMode( WrapMode::MIRRORED_REPEAT-1, WrapMode::REPEAT-1 );
+ DALI_TEST_EQUALS( wrapModeValue.Get<Vector2>(), wrapMode, TEST_LOCATION );
+ Vector2 wrapModeUniform;
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector2>( "wrapMode", wrapModeUniform ) );
+ DALI_TEST_EQUALS( wrapMode, wrapModeUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ visual.SetOffStage( actor );
+ DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+ END_TEST;
+}
+
+int UtcDaliVisualFactoryGetImageVisual4(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualFactoryGetImageVisual4: Request image visual with a Property::Map, test custom wrap mode and pixel area without atlasing" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ // Test wrap mode without atlasing. Image with a size bigger than 512*512 will NOT be uploaded as a part of the atlas.
+ const int width=600;
+ const int height=600;
+ const Vector4 pixelArea(-0.5f, -0.5f, 2.f, 2.f);
+
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, gImage_600_RGB );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_WIDTH, width );
+ propertyMap.Insert( ImageVisual::Property::DESIRED_HEIGHT, height );
+ propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true );
+ propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
+ propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
+ propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
+
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ Actor actor = Actor::New();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+ TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
+ texParameterTrace.Enable( true );
+
+ actor.SetSize( 200.f, 200.f );
+ Stage::GetCurrent().Add( actor );
+ visual.SetOnStage( actor );
+
+ // loading started
+ application.SendNotification();
+ application.Render();
+ application.Render();
+ application.SendNotification();
+ BitmapLoader loader = BitmapLoader::GetLatestCreated();
+ DALI_TEST_CHECK( loader );
+ loader.WaitForLoading();// waiting until the image to be loaded
+ DALI_TEST_CHECK( loader.IsLoaded() );
+
+ DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+
+ // WITHOUT atlasing, the wrapping is handled by setting gl texture parameters
+ std::stringstream out;
+ out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_MIRRORED_REPEAT;
+ DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+ out.str("");
+ out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_REPEAT;
+ DALI_TEST_CHECK( texParameterTrace.FindMethodAndParams("TexParameteri", out.str()) );
+
+ // test the uniforms which used to handle the wrap mode
+ Renderer renderer = actor.GetRendererAt( 0u );
+ DALI_TEST_CHECK( renderer );
+
+ Property::Value pixelAreaValue = renderer.GetProperty( renderer.GetPropertyIndex( "pixelArea" ) );
+ DALI_TEST_EQUALS( pixelAreaValue.Get<Vector4>(), pixelArea, TEST_LOCATION );
+ Vector4 pixelAreaUniform;
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "pixelArea", pixelAreaUniform ) );
+ DALI_TEST_EQUALS( pixelArea, pixelAreaUniform, Math::MACHINE_EPSILON_100, TEST_LOCATION );
+
+ Property::Index wrapModeIndex = renderer.GetPropertyIndex( "wrapMode" );
+ DALI_TEST_CHECK(wrapModeIndex == Property::INVALID_INDEX);
+
+ visual.SetOffStage( actor );
+ DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
+
+ END_TEST;
+}
+
int UtcDaliVisualFactoryGetNPatchVisual1(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual1: Request 9-patch renderer with a Property::Map" );
+ tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual1: Request 9-patch visual with a Property::Map" );
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
int UtcDaliVisualFactoryGetNPatchVisual2(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual2: Request n-patch renderer with a Property::Map" );
+ tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual2: Request n-patch visual with a Property::Map" );
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
int UtcDaliVisualFactoryGetNPatchVisual3(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual3: Request 9-patch renderer with an image url" );
+ tet_infoline( "UtcDaliVisualFactoryGetNPatchVisual3: Request 9-patch visual with an image url" );
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
//This should still load but display an error image
ToolkitTestApplication application;
- tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid Property::Map" );
+ tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid URL" );
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, 111 );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
propertyMap.Insert( ImageVisual::Property::URL, "ERROR.9.jpg" );
Visual::Base visual = factory.CreateVisual( propertyMap );
END_TEST;
}
+int UtcDaliVisualFactoryGetNPatchVisualN3(void)
+{
+ // Passing in an invalid visual type so we should not get a visual
+
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliVisualFactoryGetNPatchVisualN: Request n-patch visual with an invalid visual type" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, 111 );
+ propertyMap.Insert( ImageVisual::Property::URL, "ERROR.9.jpg" );
+
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( !visual );
+
+ END_TEST;
+}
+
int UtcDaliVisualFactoryGetSvgVisual(void)
{
ToolkitTestApplication application;
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
+ // renderer is not added to actor until the rasterization is completed.
+ DALI_TEST_CHECK( actor.GetRendererCount() == 0u );
EventThreadCallback* eventTrigger = EventThreadCallback::Get();
CallbackBase* callback = eventTrigger->GetCallback();
eventTrigger->WaitingForTrigger( 1 );// waiting until the svg image is rasterized.
CallbackBase::Execute( *callback );
+ // renderer is added to actor
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
// waiting for the resource uploading
END_TEST;
}
-//Creates a mesh renderer from the given propertyMap and tries to load it on stage in the given application.
+//Creates a mesh visual from the given propertyMap and tries to load it on stage in the given application.
//This is expected to succeed, which will then pass the test.
void MeshVisualLoadsCorrectlyTest( Property::Map& propertyMap, ToolkitTestApplication& application )
{
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
propertyMap.Insert( PrimitiveVisual::Property::STACKS, 20 );
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONICAL_FRUSTRUM );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
propertyMap.Insert( PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS, 40.0f );
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::BEVELLED_CUBE );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, 0.7f );
//Test to see if shape loads correctly.
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::OCTAHEDRON );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
//Test to see if shape loads correctly.
TestPrimitiveVisualWithProperties( propertyMap, application );
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CONE );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
propertyMap.Insert( PrimitiveVisual::Property::SLICES, 10 );
propertyMap.Insert( PrimitiveVisual::Property::SCALE_TOP_RADIUS, 30.0f );
propertyMap.Insert( PrimitiveVisual::Property::SCALE_HEIGHT, 50.0f );
Property::Map propertyMap;
propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
- propertyMap.Insert( PrimitiveVisual::Property::COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
+ propertyMap.Insert( PrimitiveVisual::Property::MIX_COLOR, Vector4( 0.5, 0.5, 0.5, 1.0 ) );
propertyMap.Insert( MeshVisual::Property::LIGHT_POSITION, Vector3( 0.0, 1.0, 2.0 ) );
//Test to see if shape loads correctly.
END_TEST;
}
-//Test if primitive shape renderer handles the case of not being passed a specific shape to use.
+//Test if primitive shape loads correctly when told to use too many slices.
+int UtcDaliVisualFactoryGetPrimitiveVisual9(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual9: Request primitive visual with above-cap slices." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::SLICES, Property::Value( 1000000 ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too few slices. (2 slices or less.)
+int UtcDaliVisualFactoryGetPrimitiveVisual10(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual10: Request primitive visual with too few slices." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::SLICES, Property::Value( 2 ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too many stacks.
+int UtcDaliVisualFactoryGetPrimitiveVisual11(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual11: Request primitive visual with too many stacks." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::STACKS, Property::Value( 1000000 ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too few stacks. (1 stack or less.)
+int UtcDaliVisualFactoryGetPrimitiveVisual12(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual12: Request primitive visual with too few stacks." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::STACKS, Property::Value( 1 ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use invalid (zero or negative) dimensions.
+int UtcDaliVisualFactoryGetPrimitiveVisual13(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual13: Request primitive visual with invalid scale dimensions." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::SCALE_DIMENSIONS, Vector3::ZERO );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too low a bevel percentage.
+int UtcDaliVisualFactoryGetPrimitiveVisual14(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual14: Request primitive visual with too low a bevel percentage." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, Property::Value( -1.0f ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too high a bevel percentage.
+int UtcDaliVisualFactoryGetPrimitiveVisual15(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual15: Request primitive visual with too high a bevel percentage." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_PERCENTAGE, Property::Value( 2.0f ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too low a bevel smoothness.
+int UtcDaliVisualFactoryGetPrimitiveVisual16(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual16: Request primitive visual with too low a bevel smoothness." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, Property::Value( -1.0f ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape loads correctly when told to use too high a bevel smoothness.
+int UtcDaliVisualFactoryGetPrimitiveVisual17(void)
+{
+ //Set up test application first, so everything else can be handled.
+ ToolkitTestApplication application;
+
+ tet_infoline( "UtcDaliVisualFactoryGetPrimitiveVisual17: Request primitive visual with too high a bevel smoothness." );
+
+ //Set up visual properties.
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::PRIMITIVE );
+ propertyMap.Insert( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::SPHERE );
+ propertyMap.Insert( PrimitiveVisual::Property::BEVEL_SMOOTHNESS, Property::Value( 2.0f ) );
+
+ //Test to see if shape loads correctly.
+ TestPrimitiveVisualWithProperties( propertyMap, application );
+
+ END_TEST;
+}
+
+//Test if primitive shape visual handles the case of not being passed a specific shape to use.
int UtcDaliVisualFactoryGetPrimitiveVisualN1(void)
{
//Set up test application first, so everything else can be handled.
DALI_TEST_CHECK( factory );
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::BATCH_IMAGE );
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
// Create a normal Image Visual.
propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
// Instruct the factory to change Image Visuals to Batch-Image Visuals.
- propertyMap.Insert( Visual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
// Properties for the Batch-Image Visual.
- propertyMap.Insert( BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::BATCH_IMAGE, TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::IMAGE, TEST_LOCATION );
Actor actor = Actor::New();
// Create a property-map that enables batching.
Property::Map propertyMap;
- propertyMap.Insert( Dali::Toolkit::BatchImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- propertyMap.Insert( Visual::Property::BATCHING_ENABLED, true );
+ propertyMap.Insert( Dali::Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+ propertyMap.Insert( ImageVisual::Property::BATCHING_ENABLED, true );
// Create an ImageView, passing the property-map in to instruct it to use batching.
Toolkit::ImageView imageView = Toolkit::ImageView::New();
develapibloomviewdir = $(develapicontrolsdir)/bloom-view
develapibubbleemitterdir = $(develapicontrolsdir)/bubble-effect
develapieffectsviewdir = $(develapicontrolsdir)/effects-view
+develapigaussianblurviewdir = $(develapicontrolsdir)/gaussian-blur-view
develapimagnifierdir = $(develapicontrolsdir)/magnifier
develapipopupdir = $(develapicontrolsdir)/popup
+develapiprogressbardir = $(develapicontrolsdir)/progress-bar
develapishadowviewdir = $(develapicontrolsdir)/shadow-view
develapisuperblurviewdir = $(develapicontrolsdir)/super-blur-view
develapifocusmanagerdir = $(develapidir)/focus-manager
develapibuilder_HEADERS = $(devel_api_builder_header_files)
develapieffectsview_HEADERS = $(devel_api_effects_view_header_files)
develapifocusmanager_HEADERS = $(devel_api_focus_manager_header_files)
+develapigaussianblurview_HEADERS = $(devel_api_gaussian_blur_view_header_files)
develapiimageatlas_HEADERS = $(devel_api_image_atlas_header_files)
develapimagnifier_HEADERS = $(devel_api_magnifier_header_files)
develapipopup_HEADERS = $(devel_api_popup_header_files)
+develapiprogressbar_HEADERS = $(devel_api_progress_bar_header_files)
develapivisualfactory_HEADERS = $(devel_api_visual_factory_header_files)
develapiscripting_HEADERS = $(devel_api_scripting_header_files)
develapishadowview_HEADERS = $(devel_api_shadow_view_header_files)
publicapibuttonsdir = $(publicapicontrolsdir)/buttons
publicapidefaultcontrolsdir = $(publicapicontrolsdir)/default-controls
publicapiflexcontainerdir = $(publicapicontrolsdir)/flex-container
-publicapigaussianblurviewdir = $(publicapicontrolsdir)/gaussian-blur-view
publicapiimageviewdir = $(publicapicontrolsdir)/image-view
publicapivideoviewdir = $(publicapicontrolsdir)/video-view
publicapimodel3dviewdir = $(publicapicontrolsdir)/model3d-view
publicapibuttons_HEADERS = $(public_api_buttons_header_files)
publicapidefaultcontrols_HEADERS = $(public_api_default_controls_header_files)
publicapiflexcontainer_HEADERS = $(public_api_flex_container_header_files)
-publicapigaussianblurview_HEADERS = $(public_api_gaussian_blur_view_header_files)
publicapiimageview_HEADERS = $(public_api_image_view_header_files)
publicapivideoview_HEADERS = $(public_api_video_view_header_files)
publicapiitemview_HEADERS = $(public_api_item_view_header_files)
# For Open Source DALi API Reference
ALIASES += SINCE_1_0="@since 1.0"
ALIASES += SINCE_1_1="@since 1.1"
+ALIASES += SINCE_1_2="@since 1.2"
+
+# Extra tags for Tizen 3.0
+ALIASES += SINCE_1_2_2="@since 1.2.2"
+ALIASES += SINCE_1_2_4="@since 1.2.4"
+ALIASES += SINCE_1_2_5="@since 1.2.5"
ALIASES += DEPRECATED_1_0="@deprecated Deprecated since 1.0"
ALIASES += DEPRECATED_1_1="@deprecated Deprecated since 1.1"
+ALIASES += DEPRECATED_1_2="@deprecated Deprecated since 1.2"
ALIASES += PLATFORM=""
ALIASES += PRIVLEVEL_PLATFORM=""
+ALIASES += PRIVLEVEL_PUBLIC=""
ALIASES += PRIVILEGE_KEYGRAB=""
+ALIASES += PRIVILEGE_DISPLAY=""
+ALIASES += REMARK_INTERNET=""
############################################
## For Tizen Native API Reference
#ALIASES += SINCE_1_0="\par Since:\n 2.4, DALi version 1.0"
#ALIASES += SINCE_1_1="\par Since:\n 3.0, DALi version 1.1"
+#ALIASES += SINCE_1_2="\par Since:\n 4.0, DALi version 1.2"
+
+## Extra tags for Tizen 3.0
+#ALIASES += SINCE_1_2_2="\par Since:\n 3.0, DALi version 1.2.2"
+#ALIASES += SINCE_1_2_4="\par Since:\n 3.0, DALi version 1.2.4"
+#ALIASES += SINCE_1_2_5="\par Since:\n 3.0, DALi version 1.2.5"
## DALi has no deprecated API in Tizen 2.4 because it's DALi's first release.
## Thus deprecated APIs in DALi 1.0.xx will be deprecated in Tizen 3.0.
#ALIASES += DEPRECATED_1_0="@deprecated Deprecated since 3.0, DALi version 1.0"
#ALIASES += DEPRECATED_1_1="@deprecated Deprecated since 3.0, DALi version 1.1"
+#ALIASES += DEPRECATED_1_2="@deprecated Deprecated since 4.0, DALi version 1.2"
#ALIASES += PLATFORM="@platform"
#ALIASES += PRIVLEVEL_PLATFORM="\par Privilege Level:\n platform"
+#ALIASES += PRIVLEVEL_PUBLIC="\par Privilege Level:\n public"
#ALIASES += PRIVILEGE_KEYGRAB="\par Privilege:\n http://tizen.org/privilege/keygrab"
+#ALIASES += PRIVILEGE_DISPLAY="\par Privilege:\n http://tizen.org/privilege/display"
+#ALIASES += REMARK_INTERNET="@remarks %http://tizen.org/privilege/internet is needed if @a url is a http or https address."
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
# *.qsf, *.as and *.js.
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.d \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
+FILE_PATTERNS = \
*.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.idl \
- *.odl \
- *.cs \
- *.php \
- *.php3 \
- *.inc \
- *.m \
- *.md \
- *.mm \
- *.dox \
- *.py \
- *.f90 \
- *.f \
- *.vhd \
- *.vhdl
+ *.md
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
#include <dali-toolkit/public-api/controls/buttons/radio-button.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/control.h>
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
#include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
#include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
#include <dali-toolkit/public-api/text/rendering-backend.h>
-#include <dali-toolkit/public-api/visuals/batch-image-visual-properties.h>
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
#define __DALI_TOOLKIT_UIBUILDER_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/animation/linear-constrainer.h>
#include <dali/devel-api/animation/path-constrainer.h>
#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
namespace Dali
{
/*
- * 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.
// EXTERNAL INCLUDES
#include <cstring>
+#include <algorithm>
// INTERNAL INCLUDES
#include "dali-toolkit/devel-api/builder/tree-node.h"
#include "dali-toolkit/internal/builder/tree-node-manipulator.h"
+namespace
+{
+
+bool CaseInsensitiveCharacterCompare( unsigned char a, unsigned char b )
+{
+ // Converts to lower case in the current locale.
+ return std::tolower( a ) == std::tolower( b );
+}
+
+/**
+ * return true if the lower cased ASCII strings are equal.
+ */
+bool CaseInsensitiveStringCompare( const std::string& a, const std::string& b )
+{
+ bool result = false;
+ if( a.length() == b.length() )
+ {
+ result = std::equal( a.begin(), a.end(), b.begin(), CaseInsensitiveCharacterCompare );
+ }
+ return result;
+}
+
+} // anonymous namespace
+
+
namespace Dali
{
return mIntValue == 1 ? true : false;
}
-
size_t TreeNode::Size() const
{
size_t c = 0;
return NULL;
}
+
+const TreeNode* TreeNode::GetChildIgnoreCase(const std::string& childName) const
+{
+ const TreeNode* p = mFirstChild;
+ while(p)
+ {
+ if(p->mName)
+ {
+ std::string nodeName(p->mName);
+ if( CaseInsensitiveStringCompare( nodeName, childName) )
+ {
+ return p;
+ }
+ }
+ p = p->mNextSibling;
+ }
+ return NULL;
+}
+
const TreeNode* TreeNode::Find(const std::string& childName) const
{
if(mName && std::string(mName) == childName)
#define __DALI_SCRIPT_TREE_NODE_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.
bool HasSubstitution() const;
/*
- * Gets a child of the node
- * @param name The name of the child
+ * Gets a child of the node (using case sensitive matching)
+ * @param name The name of the child.
* @return The child if found, else NULL
*/
const TreeNode* GetChild(const std::string& name) const;
+ /*
+ * Gets a child of the node (using case insensitive matching)
+ * @param name The name of the child in lower case
+ * @return The child if found, else NULL
+ */
+ const TreeNode* GetChildIgnoreCase(const std::string& name) const;
+
/*
* Recursively search for a child of the node
* @param name The name of the child
#define __DALI_TOOLKIT_BLOOM_VIEW_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.
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/images/pixel.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
namespace Dali
{
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+GaussianBlurView::GaussianBlurView()
+{
+}
+
+GaussianBlurView::~GaussianBlurView()
+{
+}
+
+GaussianBlurView::GaussianBlurView(const GaussianBlurView& handle)
+ : Control( handle )
+{
+}
+
+GaussianBlurView& GaussianBlurView::operator=(const GaussianBlurView& rhs)
+{
+ if( &rhs != this )
+ {
+ Control::operator=(rhs);
+ }
+ return *this;
+}
+
+GaussianBlurView GaussianBlurView::New()
+{
+ return Internal::GaussianBlurView::New();
+}
+
+GaussianBlurView GaussianBlurView::New( const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
+ const float downsampleWidthScale, const float downsampleHeightScale,
+ bool blurUserImage)
+{
+ return Internal::GaussianBlurView::New( numSamples, blurBellCurveWidth, renderTargetPixelFormat,
+ downsampleWidthScale, downsampleHeightScale,
+ blurUserImage);
+}
+
+GaussianBlurView::GaussianBlurView( Internal::GaussianBlurView& implementation )
+: Control( implementation )
+{
+}
+
+GaussianBlurView::GaussianBlurView( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+ VerifyCustomActorPointer<Internal::GaussianBlurView>(internal);
+}
+
+GaussianBlurView GaussianBlurView::DownCast( BaseHandle handle )
+{
+ return Control::DownCast<GaussianBlurView, Internal::GaussianBlurView>(handle);
+}
+
+void GaussianBlurView::Add(Actor child)
+{
+ GetImpl(*this).Add(child);
+}
+
+void GaussianBlurView::Remove(Actor child)
+{
+ GetImpl(*this).Remove(child);
+}
+
+void GaussianBlurView::Activate()
+{
+ GetImpl(*this).Activate();
+}
+
+void GaussianBlurView::ActivateOnce()
+{
+ GetImpl(*this).ActivateOnce();
+}
+
+void GaussianBlurView::Deactivate()
+{
+ GetImpl(*this).Deactivate();
+}
+
+void GaussianBlurView::SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget)
+{
+ GetImpl(*this).SetUserImageAndOutputRenderTarget(inputImage, outputRenderTarget);
+}
+
+Property::Index GaussianBlurView::GetBlurStrengthPropertyIndex() const
+{
+ return GetImpl(*this).GetBlurStrengthPropertyIndex();
+}
+
+FrameBufferImage GaussianBlurView::GetBlurredRenderTarget() const
+{
+ return GetImpl(*this).GetBlurredRenderTarget();
+}
+
+void GaussianBlurView::SetBackgroundColor( const Vector4& color )
+{
+ GetImpl(*this).SetBackgroundColor(color);
+}
+
+Vector4 GaussianBlurView::GetBackgroundColor() const
+{
+ return GetImpl(*this).GetBackgroundColor();
+}
+
+GaussianBlurView::GaussianBlurViewSignal& GaussianBlurView::FinishedSignal()
+{
+ return GetImpl(*this).FinishedSignal();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_GAUSSIAN_BLUR_EFFECT_H__
+#define __DALI_TOOLKIT_GAUSSIAN_BLUR_EFFECT_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/actors/camera-actor.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/images/frame-buffer-image.h>
+#include <dali/public-api/render-tasks/render-task.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal DALI_INTERNAL
+{
+
+/**
+ * GaussianBlurView implementation class
+ */
+class GaussianBlurView;
+
+/**
+ * BloomView implementation class - requires access to private methods
+ */
+class BloomView;
+
+} // namespace Internal
+/**
+ * @addtogroup dali_toolkit_controls_gaussian_blur_view
+ * @{
+ */
+
+/**
+ * @brief
+ * GaussianBlurView is a class for applying a render process that blurs an image.
+ *
+ * Basic idea:-
+ *
+ * 1) The GaussianBlurView object will render all its child actors offscreen.\n
+ * 2) The GaussianBlurView object then blurs the result of step 1), using a two pass separated Gaussian blur.\n
+ * 3) The GaussianBlurView object then composites the blur from step 2) with the child actors image from step 1). See GetBlurStrengthPropertyIndex() for more info.\n
+ * 4) The GaussianBlurView object gets rendered automatically, either to the screen via the default render task, or via a RenderTask the user has created for
+ * e.g. further offscreen rendering.
+ *
+ * Fundamentally, the GaussianBlurView is simply an Actor in the normal actor tree that affects all of its children. It should be added to your Actor tree and manipulated in the
+ * normal ways. It can be considered a 'portal' in the sense that all child actors are clipped to the GaussianBlurView actor bounds.
+ *
+ * ************\n
+ * NB: It is essential to remove the GaussianBlurView from the stage and also to call Deactivate() on it when you are not using it. This will ensure that resources are freed and
+ * rendering stops.\n
+ * ************\n
+ *
+ * Usage example:-
+ *
+ * @code
+ * // Initialise
+ * GaussianBlurView gaussianBlurView = GaussianBlurView::New();
+ *
+ * // Create and add some visible actors to the GaussianBlurView, all these child actors will therefore get blurred.
+ * Image image = Image::New(...);
+ * ImageView imageView = ImageView::New(image);
+ * gaussianBlurView.Add(imageView);
+ * ...
+ *
+ * // Start rendering the GaussianBlurView
+ * Stage::GetCurrent().Add(gaussianBlurView);
+ * gaussianBlurView.Activate();
+ * ...
+ *
+ * // Animate the strength of the blur - this can fade between no blur and full blur. See GetBlurStrengthPropertyIndex().
+ * Animation blurAnimation = Animation::New( ... );
+ * blurAnimation.AnimateTo( Property( gaussianBlurView, gaussianBlurView.GetBlurStrengthPropertyIndex() ), ... );
+ * blurAnimation.Play();
+ *
+ * ...
+ * // Stop rendering the GaussianBlurView
+ * Stage::GetCurrent().Remove(gaussianBlurView);
+ * gaussianBlurView.Deactivate();
+ * @endcode
+ * @SINCE_1_0.0
+ * @remarks This is an experimental feature and might not be supported in the next release.
+ * We do recommend not to use this class.
+ */
+class DALI_IMPORT_API GaussianBlurView : public Control
+{
+public:
+ /**
+ * @brief Signal type for notifications
+ * @SINCE_1_0.0
+ */
+ typedef Signal< void (GaussianBlurView source) > GaussianBlurViewSignal;
+
+ /**
+ * @brief Create an uninitialized GaussianBlurView; this can be initialized with GaussianBlurView::New().
+ * Calling member functions with an uninitialized Dali::Object is not allowed.
+ * @SINCE_1_0.0
+ */
+ GaussianBlurView();
+
+ /**
+ * @brief Copy constructor. Creates another handle that points to the same real object.
+ * @SINCE_1_0.0
+ */
+ GaussianBlurView(const GaussianBlurView& handle);
+
+ /**
+ * @brief Assignment operator. Changes this handle to point to another real object.
+ * @SINCE_1_0.0
+ */
+ GaussianBlurView& operator=(const GaussianBlurView& ZoomView);
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ * @SINCE_1_0.0
+ */
+ ~GaussianBlurView();
+
+ /**
+ * @brief Downcast a handle to GaussianBlurView handle.
+ *
+ * If handle points to a GaussianBlurView the
+ * downcast produces valid handle. If not the returned handle is left uninitialized.
+ * @SINCE_1_0.0
+ * @param[in] handle Handle to an object
+ * @return A handle to a GaussianBlurView or an uninitialized handle
+ */
+ static GaussianBlurView DownCast( BaseHandle handle );
+
+ /**
+ * @brief Create an initialized GaussianBlurView, using default settings. The default settings are:-\n
+ *
+ * numSamples = 5\n
+ * blurBellCurveWidth = 1.5\n
+ * renderTargetPixelFormat = RGB888\n
+ * downsampleWidthScale = 0.5\n
+ * downsampleHeightScale = 0.5\n
+ * blurUserImage = false
+ * @SINCE_1_0.0
+ * @return A handle to a newly allocated Dali resource
+ */
+ static GaussianBlurView New();
+
+ /**
+ * @brief Create an initialized GaussianBlurView.
+ * @SINCE_1_0.0
+ * @param numSamples The size of the Gaussian blur kernel (number of samples in horizontal / vertical blur directions).
+ * @param blurBellCurveWidth The constant controlling the Gaussian function, must be > 0.0. Controls the width of the bell curve, i.e. the look of the blur and also indirectly
+ * the amount of blurriness Smaller numbers for a tighter curve. Useful values in the range [0.5..3.0] - near the bottom of that range the curve is weighted heavily towards
+ * the centre pixel of the kernel (so there won't be much blur), near the top of that range the pixels have nearly equal weighting (closely approximating a box filter
+ * therefore). Values close to zero result in the bell curve lying almost entirely within a single pixel, in other words there will be basically no blur as neighbouring pixels
+ * have close to zero weights.
+ * @param renderTargetPixelFormat The pixel format of the render targets we are using to perform the blur.
+ * @param downsampleWidthScale The width scale factor applied during the blur process, scaling the size of the source image to the size of the final blurred image output.
+ * Useful for downsampling - trades visual quality for processing speed. A value of 1.0f results in no scaling applied.
+ * @param downsampleHeightScale The height scale factor applied during the blur process, scaling the size of the source image to the size of the final blurred image output.
+ * Useful for downsampling - trades visual quality for processing speed. A value of 1.0f results in no scaling applied.
+ * @param blurUserImage If this is set to true, the GaussianBlurView object will operate in a special mode that allows the user to blur an image of their choice. See
+ * SetUserImageAndOutputRenderTarget().
+ * @return A handle to a newly allocated Dali resource
+ */
+ static GaussianBlurView New(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
+ const float downsampleWidthScale, const float downsampleHeightScale,
+ bool blurUserImage = false);
+
+ /**
+ * @DEPRECATED_1_1.28 Use Actor::Add(Actor) instead
+ * @brief Adds a child Actor to this Actor.
+ * @SINCE_1_0.0
+ * @param [in] child The child.
+ * @pre This Actor (the parent) has been initialized.
+ * @pre The child actor has been initialized.
+ * @pre The child actor is not the same as the parent actor.
+ * @pre The actor is not the Root actor
+ * @post The child will be referenced by its parent. This means that the child will be kept alive,
+ * even if the handle passed into this method is reset or destroyed.
+ * @note If the child already has a parent, it will be removed from old parent
+ * and reparented to this actor. This may change childs position, color, shader effect,
+ * scale etc as it now inherits them from this actor.
+ */
+ void Add(Actor child);
+
+ /**
+ * @DEPRECATED_1_1.28 Use Actor::Remove(Actor) instead
+ * @brief Removes a child Actor from this Actor.
+ *
+ * If the actor was not a child of this actor, this is a no-op.
+ * @SINCE_1_0.0
+ * @param [in] child The child.
+ * @pre This Actor (the parent) has been initialized.
+ * @pre The child actor is not the same as the parent actor.
+ */
+ void Remove(Actor child);
+
+ /**
+ * @brief Start rendering the GaussianBlurView. Must be called after you Add() it to the stage.
+ * @SINCE_1_0.0
+ */
+ void Activate();
+
+ /**
+ * @brief Render the GaussianBlurView once.
+ *
+ * Must be called after you Add() it to the stage.
+ * Only works with a gaussian blur view created with blurUserImage = true.
+ * Listen to the Finished signal to determine when the rendering has completed.
+ * @SINCE_1_0.0
+ */
+ void ActivateOnce();
+
+ /**
+ * @brief Stop rendering the GaussianBlurView. Must be called after you Remove() it from the stage.
+ * @SINCE_1_0.0
+ */
+ void Deactivate();
+
+ /**
+ * @brief Sets a custom image to be blurred and a render target to receive the blurred result.
+ *
+ * If this is called the children of the GaussianBlurObject will not be rendered blurred,
+ * instead the inputImage will get blurred.
+ * To retrieve the blurred image the user can either pass a handle on a render target they own as the second parameter to SetUserImageAndOutputRenderTarget( ... ), or they
+ * can pass NULL for this parameter and instead call GetBlurredRenderTarget() which will return a handle on a render target created internally to the GaussianBlurView object.
+ * @SINCE_1_0.0
+ * @param inputImage The image that the user wishes to blur.
+ * @param outputRenderTarget A render target to receive the blurred result. Passing NULL is allowed. See also GetBlurredRenderTarget().
+ * @pre This object was created with a New( ... ) call where the blurUserImage argument was set to true. If this was not the case an exception will be thrown.
+ */
+ void SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget);
+
+ /**
+ * @brief Get the index of the property that can be used to fade the blur in / out.
+ *
+ * This is the overall strength of the blur.
+ * User can use this to animate the blur. A value of 0.0 is zero blur and 1.0 is full blur. Default is 1.0.
+ * Note that if you set the blur to 0.0, the result will be no blur BUT the internal rendering will still be happening. If you wish to turn the blur off, you should remove
+ * the GaussianBlurView object from the stage also.
+ * @SINCE_1_0.0
+ * @return Index of the property that can be used to fade the blur in / out
+ */
+ Dali::Property::Index GetBlurStrengthPropertyIndex() const;
+
+ /**
+ * @brief Get the final blurred image.
+ *
+ * Use can call this function to get the blurred result as an image, to use as they wish. It is not necessary to call this unless you specifically require it.
+ * @SINCE_1_0.0
+ * @return A handle on the blurred image, contained in a render target.
+ * @pre The user must call Activate() before the render target will be returned.
+ */
+ FrameBufferImage GetBlurredRenderTarget() const;
+
+ /**
+ * @brief Set background color for the view. The background will be filled with this color.
+ * @SINCE_1_0.0
+ * @param[in] color The background color.
+ */
+ void SetBackgroundColor( const Vector4& color );
+
+ /**
+ * @brief Get the background color.
+ * @SINCE_1_0.0
+ * @return The background color.
+ */
+ Vector4 GetBackgroundColor() const;
+
+public: // Signals
+ /**
+ * @brief If ActivateOnce has been called, then connect to this signal to be notified when the
+ * target actor has been rendered.
+ * @SINCE_1_0.0
+ * @return The Finished signal
+ */
+ GaussianBlurViewSignal& FinishedSignal();
+
+public:
+
+ /// @cond internal
+ /**
+ * @brief Creates a handle using the Toolkit::Internal implementation.
+ * @SINCE_1_0.0
+ * @param[in] implementation The UI Control implementation.
+ */
+ DALI_INTERNAL GaussianBlurView( Internal::GaussianBlurView& implementation );
+
+ /**
+ * @brief Allows the creation of this UI Control from an Internal::CustomActor pointer.
+ * @SINCE_1_0.0
+ * @param[in] internal A pointer to the internal CustomActor.
+ */
+ DALI_INTERNAL GaussianBlurView( Dali::Internal::CustomActor* internal );
+ /// @endcond
+
+};
+
+/**
+ * @}
+ */
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_GAUSSIAN_BLUR_EFFECT_H__
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/progress-bar/progress-bar-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+ProgressBar::ProgressBar()
+{
+}
+
+ProgressBar::ProgressBar( const ProgressBar& handle )
+: Control( handle )
+{
+}
+
+ProgressBar& ProgressBar::operator=( const ProgressBar& handle )
+{
+ if( &handle != this )
+ {
+ Control::operator=( handle );
+ }
+ return *this;
+}
+
+ProgressBar::ProgressBar(Internal::ProgressBar& implementation)
+: Control(implementation)
+{
+}
+
+ProgressBar::ProgressBar( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+ VerifyCustomActorPointer<Internal::ProgressBar>(internal);
+}
+
+ProgressBar ProgressBar::New()
+{
+ return Internal::ProgressBar::New();
+}
+
+ProgressBar::~ProgressBar()
+{
+}
+
+ProgressBar::ValueChangedSignalType& ProgressBar::ValueChangedSignal()
+{
+ return GetImpl( *this ).ValueChangedSignal();
+}
+
+ProgressBar ProgressBar::DownCast( BaseHandle handle )
+{
+ return Control::DownCast<ProgressBar, Internal::ProgressBar>(handle);
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_PROGRESS_BAR_H
+#define DALI_TOOLKIT_PROGRESS_BAR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal DALI_INTERNAL
+{
+class ProgressBar;
+}
+
+/**
+ * @brief ProgressBar is a control to give the user an indication of the progress of an operation.
+ *
+ * Also progress value percentage is shown as text inside the progress bar.
+ *
+ * Signals
+ * | %Signal Name | Method |
+ * |-------------------|-------------------------------|
+ * | valueChanged | @ref ValueChangedSignal() |
+ */
+class DALI_IMPORT_API ProgressBar : public Control
+{
+public:
+
+ // Properties
+
+ /**
+ * @brief The start and end property ranges for this control.
+ */
+ enum PropertyRange
+ {
+ PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< Start Index
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
+ };
+
+ /**
+ * @brief An enumeration of properties belonging to the ProgressBar class.
+ */
+ struct Property
+ {
+ enum
+ {
+
+ /**
+ * @brief The progress value of progress bar, progress runs form 0 to 1.
+ * @details Name "progressValue", type Property::FLOAT.
+ * @note Optional. If not supplied, the default is 0.
+ * @note Value should be between 0 to 1.
+ * @note If Value is set to 0, progress bar will be set to beginning.
+ * @note If Value is set to 1, progress bar will be set to end.
+ * @note Any Value outside of the range is ignored.
+ */
+ PROGRESS_VALUE = PROPERTY_START_INDEX,
+
+ /**
+ * @brief The track Visual value of progress bar, it's a full progress area and it's shown behind PROGRESS_VISUAL.
+ * @details Name "trackVisual", type Property::STRING if it is a url, map otherwise.
+ * @note Optional. If not supplied, the default track visual will be shown.
+ */
+ TRACK_VISUAL,
+
+ /**
+ * @brief The progress Visual value of progress bar, size of the progress visual is changed based on PROGRESS_VALUE.
+ * @details Name "progressVisual", type Property::STRING if it is a url, map otherwise.
+ * @note Optional. If not supplied, the default progress visual will be shown.
+ */
+ PROGRESS_VISUAL,
+ };
+ };
+
+public:
+
+ /**
+ * @brief Creates the ProgressBar control.
+ * @return A handle to the ProgressBar control
+ */
+ static ProgressBar New();
+
+ /**
+ * @brief Creates an empty ProgressBar handle.
+ */
+ ProgressBar();
+
+ /**
+ * @brief Copy constructor.
+ *
+ * Creates another handle that points to the same real object.
+ */
+ ProgressBar( const ProgressBar& handle );
+
+ /**
+ * @brief Assignment operator.
+ *
+ * Changes this handle to point to another real object.
+ */
+ ProgressBar& operator=( const ProgressBar& handle );
+
+ /**
+ * @brief Destructor.
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~ProgressBar();
+
+ /**
+ * @brief Downcast an Object handle to ProgressBar.
+ *
+ * If handle points to a ProgressBar the
+ * downcast produces valid handle. If not the returned handle is left uninitialized.
+ * @param[in] handle Handle to an object
+ * @return handle to a ProgressBar or an uninitialized handle
+ */
+ static ProgressBar DownCast( BaseHandle handle );
+
+public: // Signals
+
+ /**
+ * @brief Value changed signal type.
+ */
+ typedef Signal< void ( ProgressBar, float ) > ValueChangedSignalType;
+
+ /**
+ * @brief Signal emitted when the ProgressBar value changes.
+ *
+ * A callback of the following type may be connected:
+ * @code
+ * void YourCallbackName( ProgressBar progressBar, float value );
+ * @endcode
+ * @return The signal to connect to
+ */
+ ValueChangedSignalType& ValueChangedSignal();
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief Creates a handle using the Toolkit::Internal implementation.
+ * @param[in] implementation The Control implementation
+ */
+ DALI_INTERNAL ProgressBar(Internal::ProgressBar& implementation);
+
+ /**
+ * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
+ * @param[in] internal A pointer to the internal CustomActor
+ */
+ explicit DALI_INTERNAL ProgressBar( Dali::Internal::CustomActor* internal );
+ /// @endcond
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_PROGRESS_BAR_H
$(devel_api_src_dir)/controls/magnifier/magnifier.cpp \
$(devel_api_src_dir)/controls/popup/confirmation-popup.cpp \
$(devel_api_src_dir)/controls/popup/popup.cpp \
+ $(devel_api_src_dir)/controls/progress-bar/progress-bar.cpp \
$(devel_api_src_dir)/controls/shadow-view/shadow-view.cpp \
$(devel_api_src_dir)/controls/super-blur-view/super-blur-view.cpp \
$(devel_api_src_dir)/controls/text-controls/text-selection-popup.cpp \
$(devel_api_src_dir)/transition-effects/cube-transition-fold-effect.cpp \
$(devel_api_src_dir)/transition-effects/cube-transition-wave-effect.cpp \
$(devel_api_src_dir)/visual-factory/visual-factory.cpp \
- $(devel_api_src_dir)/visual-factory/visual-base.cpp
+ $(devel_api_src_dir)/visual-factory/visual-base.cpp \
+ $(devel_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp
# Add devel header files here
$(devel_api_src_dir)/controls/popup/confirmation-popup.h \
$(devel_api_src_dir)/controls/popup/popup.h
+devel_api_progress_bar_header_files = \
+ $(devel_api_src_dir)/controls/progress-bar/progress-bar.h
+
devel_api_visual_factory_header_files = \
$(devel_api_src_dir)/visual-factory/visual-factory.h \
$(devel_api_src_dir)/visual-factory/visual-base.h
$(devel_api_src_dir)/transition-effects/cube-transition-cross-effect.h \
$(devel_api_src_dir)/transition-effects/cube-transition-fold-effect.h \
$(devel_api_src_dir)/transition-effects/cube-transition-wave-effect.h
+
+devel_api_gaussian_blur_view_header_files = \
+ $(devel_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.h
#define __DALI_TOOLKIT_SHADER_EFFECT_BENDY_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_BLIND_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_BOUNCING_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_CAROUSEL_EFFECT_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_DISPLACEMENT_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_LOCAL_DISSOLVE_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
#include <sstream>
namespace Dali
#define __DALI_TOOLKIT_SHADER_EFFECT_IRIS_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_MASK_EFFECT_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.
// EXTERNAL INCLUDES
#include <dali/public-api/images/image.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_MIRROR_EFFECT_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_OVERLAY_EFFECT_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.
// EXTERNAL INCLUDES
#include <dali/public-api/images/image.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_QUADRATIC_BEZIER_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_RIPPLE_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_RIPPLE2D_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHEAR_EFFECT_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_SOFT_BUTTON_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_SPOT_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_SQUARE_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_SHADER_EFFECT_SWIRL_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
namespace Dali
{
namespace Toolkit
{
-namespace Visual
-{
-
-Base::Base()
+Visual::Base::Base()
{
}
-Base::~Base()
+Visual::Base::~Base()
{
}
-Base::Base( const Base& handle )
+Visual::Base::Base( const Visual::Base& handle )
: BaseHandle( handle )
{
}
-Base& Base::operator=( const Base& handle )
+Visual::Base& Visual::Base::operator=( const Visual::Base& handle )
{
BaseHandle::operator=( handle );
return *this;
}
-Base::Base(Internal::Visual::Base *impl)
+Visual::Base::Base(Internal::Visual::Base *impl)
: BaseHandle( impl )
{
}
-void Base::SetSize( const Vector2& size )
+void Visual::Base::SetSize( const Vector2& size )
{
GetImplementation( *this ).SetSize( size );
}
-const Vector2& Base::GetSize() const
+const Vector2& Visual::Base::GetSize() const
{
return GetImplementation( *this ).GetSize();
}
-void Base::GetNaturalSize(Vector2& naturalSize ) const
+void Visual::Base::GetNaturalSize(Vector2& naturalSize ) const
{
GetImplementation( *this ).GetNaturalSize( naturalSize );
}
-void Base::SetDepthIndex( float index )
+void Visual::Base::SetDepthIndex( float index )
{
GetImplementation( *this ).SetDepthIndex( index );
}
-float Base::GetDepthIndex() const
+float Visual::Base::GetDepthIndex() const
{
return GetImplementation( *this ).GetDepthIndex();
}
-void Base::SetOnStage( Actor& actor )
+void Visual::Base::SetOnStage( Actor& actor )
{
GetImplementation( *this ).SetOnStage( actor );
}
-void Base::SetOffStage( Actor& actor )
+void Visual::Base::SetOffStage( Actor& actor )
{
GetImplementation( *this ).SetOffStage( actor );
}
-void Base::RemoveAndReset( Actor& actor )
+void Visual::Base::RemoveAndReset( Actor& actor )
{
if( actor && *this )
{
Reset();
}
-void Base::CreatePropertyMap( Property::Map& map ) const
+void Visual::Base::CreatePropertyMap( Property::Map& map ) const
{
GetImplementation( *this ).CreatePropertyMap( map );
}
-} // namespace Visual
-
} // namespace Toolkit
} // namespace Dali
float GetDepthIndex() const;
/**
- * @brief Visual needs to know when when the control is put on to the stage to add the renderer.
+ * @brief Visual needs to know when the control is put on to the stage to add the renderer.
*
* This function should be called when the control is put on to the stage.
*
void SetOnStage( Actor& actor );
/**
- * @brief Visual needs to know when when the control is removed from the stage to remove the renderer.
+ * @brief Visual needs to know when the control is removed from the stage to remove the renderer.
*
* This function should be called when the control is removed from the stage
*
/*
- * 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.
AccessibilityManager::AccessibilityManager()
: mCurrentFocusActor(FocusIDPair(0, 0)),
- mFocusIndicatorActor(Actor()),
+ mFocusIndicatorActor(),
mRecursiveFocusMoveCounter(0),
mIsWrapped(false),
mIsFocusWithinGroup(false),
void AccessibilityManager::Initialise()
{
- CreateDefaultFocusIndicatorActor();
-
AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
adaptor.SetActionHandler(*this);
adaptor.SetGestureHandler(*this);
if(actorVisible && actorFocusable && actorOpaque)
{
// Draw the focus indicator upon the focused actor
- if(mIsFocusIndicatorEnabled && mFocusIndicatorActor)
+ if( mIsFocusIndicatorEnabled )
{
- actor.Add(mFocusIndicatorActor);
+ actor.Add( GetFocusIndicatorActor() );
}
// Send notification for the change of focus actor
void AccessibilityManager::ClearFocus()
{
Actor actor = GetCurrentFocusActor();
- if(actor)
+ if( actor && mFocusIndicatorActor )
{
- actor.Remove(mFocusIndicatorActor);
+ actor.Remove( mFocusIndicatorActor );
}
mCurrentFocusActor = FocusIDPair(0, 0);
void AccessibilityManager::SetFocusIndicatorActor(Actor indicator)
{
- mFocusIndicatorActor = indicator;
+ if( mFocusIndicatorActor != indicator )
+ {
+ Actor currentFocusActor = GetCurrentFocusActor();
+ if( currentFocusActor )
+ {
+ // The new focus indicator should be added to the current focused actor immediately
+ if( mFocusIndicatorActor )
+ {
+ currentFocusActor.Remove( mFocusIndicatorActor );
+ }
+
+ if( indicator )
+ {
+ currentFocusActor.Add( indicator );
+ }
+ }
+
+ mFocusIndicatorActor = indicator;
+ }
}
Actor AccessibilityManager::GetFocusIndicatorActor()
{
+ if( ! mFocusIndicatorActor )
+ {
+ // Create the default if it hasn't been set and one that's shared by all the keyboard focusable actors
+ mFocusIndicatorActor = Toolkit::ImageView::New( FOCUS_BORDER_IMAGE_PATH );
+ mFocusIndicatorActor.SetParentOrigin( ParentOrigin::CENTER );
+ mFocusIndicatorActor.SetZ( 1.0f );
+
+ // Apply size constraint to the focus indicator
+ mFocusIndicatorActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ }
+
return mFocusIndicatorActor;
}
}
}
-void AccessibilityManager::CreateDefaultFocusIndicatorActor()
-{
- // Create a focus indicator actor shared by all the focusable actors
- Toolkit::ImageView focusIndicator = Toolkit::ImageView::New(FOCUS_BORDER_IMAGE_PATH);
- focusIndicator.SetParentOrigin( ParentOrigin::CENTER );
- focusIndicator.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
-
- // Apply size constraint to the focus indicator
- focusIndicator.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
-
- SetFocusIndicatorActor(focusIndicator);
-}
-
bool AccessibilityManager::ChangeAccessibilityStatus()
{
AccessibilityAdaptor adaptor = AccessibilityAdaptor::Get();
Actor actor = GetCurrentFocusActor();
if(actor)
{
- if(mFocusIndicatorActor)
- {
- actor.Add(mFocusIndicatorActor);
- }
+ actor.Add( GetFocusIndicatorActor() );
}
mIsFocusIndicatorEnabled = true;
{
// Hide indicator when tts turned off
Actor actor = GetCurrentFocusActor();
- if(actor)
+ if( actor && mFocusIndicatorActor )
{
- actor.Remove(mFocusIndicatorActor);
+ actor.Remove( mFocusIndicatorActor );
}
mIsFocusIndicatorEnabled = false;
#define __DALI_TOOLKIT_INTERNAL_ACCESSIBILITY_MANAGER_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.
*/
void DoActivate(Actor actor);
- /**
- * Create the default indicator actor to highlight the focused actor.
- */
- void CreateDefaultFocusIndicatorActor();
-
/**
* Set whether the actor is focusable or not. A focusable property will be registered for
* the actor if not yet.
#define __DALI_TOOLKIT_INTERNAL_BUILDER_GET_IS_INL__
/*
- * Copyright (c) 2014 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.
}
}
+inline OptionalChild IsChildIgnoreCase(const TreeNode* node, const std::string& childName)
+{
+ if( node )
+ {
+ const TreeNode* c = node->GetChildIgnoreCase(childName);
+ if( NULL != c )
+ {
+ return OptionalChild( *c );
+ }
+ else
+ {
+ return OptionalChild();
+ }
+ }
+ else
+ {
+ return OptionalChild();
+ }
+}
+
inline OptionalChild IsChild(const TreeNode& node, const std::string& childName)
{
return IsChild(&node, childName);
}
+inline OptionalChild IsChildIgnoreCase(const TreeNode& node, const std::string& childName)
+{
+ return IsChildIgnoreCase(&node, childName);
+}
+
inline OptionalString IsString(const OptionalChild& node)
{
if( node && (*node).GetType() == TreeNode::STRING )
}
/*
- * Recursively collects all stylesin a node (An array of style names).
+ * Recursively collects all styles in a node (An array of style names).
*
* stylesCollection The set of styles from the json file (a json object of named styles)
* style The style array to begin the collection from
{
if( OptionalString styleName = IsString( (*iter).second ) )
{
- if( OptionalChild node = IsChild( stylesCollection, *styleName) )
+ if( OptionalChild node = IsChildIgnoreCase( stylesCollection, *styleName) )
{
styleList.push_back( &(*node) );
DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
OptionalChild styles = IsChild( *mParser.GetRoot(), KEYNAME_STYLES );
- OptionalChild style = IsChild( *styles, styleName );
+
+ std::string styleNameLower(styleName);
+ OptionalChild style = IsChildIgnoreCase( *styles, styleNameLower );
if( styles && style )
{
#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
// Create render targets
// create off screen buffer of new size to render our child actors to
- mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
- mBloomExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
- FrameBufferImage mBlurExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat, Dali::Image::UNUSED );
- mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED);
+ mRenderTargetForRenderingChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mBloomExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat );
+ FrameBufferImage mBlurExtractTarget = FrameBufferImage::New( mDownsampledWidth, mDownsampledHeight, mPixelFormat );
+ mOutputRenderTarget = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
//////////////////////////////////////////////////////
#define __DALI_TOOLKIT_INTERNAL_BLOOM_VIEW_H__
/*
- * Copyright (c) 2014 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.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
mBubbleRoot.SetSize(mMovementArea);
// Prepare the frame buffer to store the color adjusted background image
- mEffectImage = FrameBufferImage::New( mMovementArea.width/4.f, mMovementArea.height/4.f, Pixel::RGBA8888, Dali::Image::UNUSED );
+ mEffectImage = FrameBufferImage::New( mMovementArea.width/4.f, mMovementArea.height/4.f, Pixel::RGBA8888 );
// Generate the geometry, which is used by all bubbleActors
mMeshGeometry = CreateGeometry( mNumBubblePerActor*mDensity );
visual = visualFactory.CreateVisual( map );
RegisterVisual( visualIndex, placementActor, visual );
- visual.SetOnStage( placementActor );
SetupContent( *contentActor, placementActor ); //
contentActor->SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
/*
- * Copyright (c) 2014 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-toolkit/internal/controls/image-view/image-view-impl.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
+#include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
namespace Dali
{
#define __DALI_TOOLKIT_INTERNAL_CHECK_BOX_BUTTON_H__
/*
- * Copyright (c) 2014 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.
// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
+#include <dali/devel-api/shader-effects/shader-effect.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
-#include <dali-toolkit/devel-api/shader-effects/image-region-effect.h>
#include "button-impl.h"
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
#include <dali-toolkit/internal/filters/emboss-filter.h>
#include <dali-toolkit/internal/filters/spread-filter.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
{
RemoveFilters();
Actor self = Self();
- Property::Map visualMap;
- visualMap.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
switch( type )
{
}
}
+ Image dummyImage; // Dummy image, force creation of an image visual
+ InitializeVisual( self, mVisualPostFilter, dummyImage );
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = EFFECTS_VIEW_VERTEX_SOURCE;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EFFECTS_VIEW_FRAGMENT_SOURCE;
- visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
- InitializeVisual( self, mVisualPostFilter, visualMap );
+ Toolkit::GetImplementation( mVisualPostFilter ).SetCustomShader( customShader );
mEffectType = type;
}
Actor self( Self() );
- mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
+ mImageForChildren = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
InitializeVisual( self, mVisualForChildren, mImageForChildren );
mVisualForChildren.SetDepthIndex( DepthIndex::CONTENT+1 );
- mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Dali::Image::UNUSED );
+ mImagePostFilter = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
TextureSet textureSet = TextureSet::New();
TextureSetImage( textureSet, 0u, mImagePostFilter );
self.GetRendererAt( 0 ).SetTextures( textureSet );
#define __DALI_TOOLKIT_INTERNAL_EFFECTS_VIEW_H__
/*
- * Copyright (c) 2014 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.
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/effects-view/effects-view.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
namespace Dali
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
// TODO:
#define __DALI_TOOLKIT_INTERNAL_GAUSSIAN_BLUR_EFFECT_H__
/*
- * Copyright (c) 2014 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.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
namespace Dali
mImage = image;
Actor self( Self() );
- InitializeVisual( self, mVisual, image );
+ mVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
+ RegisterVisual( Toolkit::ImageView::Property::IMAGE, self, mVisual );
mImageSize = image ? ImageDimensions( image.GetWidth(), image.GetHeight() ) : ImageDimensions( 0, 0 );
RelayoutRequest();
mPropertyMap = map;
Actor self( Self() );
- InitializeVisual( self, mVisual, mPropertyMap );
+ mVisual = Toolkit::VisualFactory::Get().CreateVisual( mPropertyMap );
+ RegisterVisual( Toolkit::ImageView::Property::IMAGE, self, mVisual );
Property::Value* widthValue = mPropertyMap.Find( "width" );
if( widthValue )
}
Actor self( Self() );
- InitializeVisual( self, mVisual, url, size );
+ mVisual = Toolkit::VisualFactory::Get().CreateVisual( url, size );
+ RegisterVisual( Toolkit::ImageView::Property::IMAGE, self, mVisual );
mVisual.SetSize( mSizeSet );
// Private methods
//
-void ImageView::OnStageConnection( int depth )
-{
- Control::OnStageConnection( depth );
-
- if( mVisual )
- {
- CustomActor self = Self();
- mVisual.SetOnStage( self );
- }
-}
-
-void ImageView::OnStageDisconnection()
-{
- if( mVisual )
- {
- CustomActor self = Self();
- mVisual.SetOffStage( self );
- }
-
- Control::OnStageDisconnection();
-}
-
void ImageView::OnSizeSet( const Vector3& targetSize )
{
Control::OnSizeSet( targetSize );
private: // From Control
- /**
- * @copydoc Toolkit::Control::OnStageConnect()
- */
- virtual void OnStageConnection( int depth );
-
- /**
- * @copydoc Toolkit::Control::OnStageDisconnection()
- */
- virtual void OnStageDisconnection();
-
/**
* @copydoc Toolkit::Control::OnSizeSet()
*/
{
mRenderer.SetGeometry( mMesh );
mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
+ mRenderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON );
}
}
}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/controls/progress-bar/progress-bar-impl.h>
+
+// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
+#include <sstream>
+#include <algorithm>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/size-negotiation/relayout-container.h>
+#include <dali/public-api/math/math-utils.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace // Unnamed namespace
+{
+
+BaseHandle Create()
+{
+ return Dali::Toolkit::ProgressBar::New();
+}
+
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::ProgressBar, Toolkit::Control, Create )
+
+DALI_PROPERTY_REGISTRATION( Toolkit, ProgressBar, "progressValue", FLOAT, PROGRESS_VALUE )
+DALI_PROPERTY_REGISTRATION( Toolkit, ProgressBar, "trackVisual", MAP, TRACK_VISUAL )
+DALI_PROPERTY_REGISTRATION( Toolkit, ProgressBar, "progressVisual", MAP, PROGRESS_VISUAL )
+DALI_SIGNAL_REGISTRATION( Toolkit, ProgressBar, "valueChanged", SIGNAL_VALUE_CHANGED )
+
+DALI_TYPE_REGISTRATION_END()
+
+const char* SKINNED_TRACK_VISUAL = DALI_IMAGE_DIR "slider-skin.9.png";
+const char* SKINNED_PROGRESS_VISUAL = DALI_IMAGE_DIR "slider-skin-progress.9.png";
+
+float DEFAULT_VALUE = 0.0f;
+float DEFAULT_LOWER_BOUND = 0.0f;
+float DEFAULT_UPPER_BOUND = 1.0f;
+float DEFAULT_PADDING = 24.0f;
+
+} // Unnamed namespace
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// ProgressBar
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+Dali::Toolkit::ProgressBar ProgressBar::New()
+{
+ // Create the implementation
+ ProgressBarPtr progressBar( new ProgressBar() );
+
+ // Pass ownership to CustomActor via derived handle
+ Dali::Toolkit::ProgressBar handle( *progressBar );
+
+ // Second-phase init of the implementation
+ // This can only be done after the CustomActor connection has been made...
+ progressBar->Initialize();
+
+ return handle;
+}
+
+ProgressBar::ProgressBar()
+: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+ mTrackVisual(""),
+ mProgressVisual(""),
+ mTrackMap(),
+ mTrackVisualSize(),
+ mProgressVisualSize(),
+ mValue( DEFAULT_VALUE )
+{
+}
+
+ProgressBar::~ProgressBar()
+{
+}
+
+void ProgressBar::OnInitialize()
+{
+ // Setup
+ CreateChildren();
+
+ // Properties
+ SetTrackVisual( SKINNED_TRACK_VISUAL );
+ SetProgressVisual( SKINNED_PROGRESS_VISUAL );
+
+ DisplayValue( mValue, false ); // Run this last to display the correct value
+}
+
+void ProgressBar::OnRelayout( const Vector2& size, RelayoutContainer& container )
+{
+ Vector2 trackSize( size );
+ trackSize.width = std::max( 0.0f, size.width - DEFAULT_PADDING ); // Ensure we don't go negative
+
+ // Track
+ if( mTrack )
+ {
+ container.Add( mTrack, trackSize );
+
+ // mValueTextLabel will have its relayout method called automatically as it's a child of mTrack,
+ // which is added to the container
+ }
+
+ // Progress bar
+ if( mProgress )
+ {
+ mDomain = CalcDomain( trackSize );
+
+ Vector2 progressSize( trackSize );
+
+ // If no progress, then we do not want a n-patch image shown incorrectly
+ progressSize.width = std::max( mProgressVisualSize.width, mDomain.from.x + mValue * ( mDomain.to.x - mDomain.from.x ) );
+ progressSize.width = std::min( progressSize.width, trackSize.width ); // We should not exceed given size
+
+ container.Add( mProgress, progressSize );
+ }
+}
+
+Vector3 ProgressBar::GetNaturalSize()
+{
+ // Return the maximum width/height combinations of our visuals
+
+ Vector3 naturalSize;
+ naturalSize.width = std::max( mTrackVisualSize.width, mProgressVisualSize.width );
+ naturalSize.height = std::max( mTrackVisualSize.height, mProgressVisualSize.height );
+ return naturalSize;
+}
+
+ProgressBar::Domain ProgressBar::CalcDomain( const Vector2& currentSize )
+{
+ return Domain( Vector2( 0.0f, 0.0f ), currentSize );
+}
+
+void ProgressBar::DisplayValue( float value, bool raiseSignals )
+{
+ // Signals
+ if( raiseSignals )
+ {
+ Toolkit::ProgressBar self = Toolkit::ProgressBar::DownCast( Self() );
+ mValueChangedSignal.Emit( self, value );
+ }
+
+ // Change the value of the text label
+ if( mValueTextLabel )
+ {
+ std::stringstream ss;
+ ss.precision( 0 );
+ ss << std::fixed << ( value * 100 ) << "%";
+
+ std::string label = mValueTextLabel.GetProperty<std::string>( Toolkit::TextLabel::Property::TEXT );
+ if( label.compare(ss.str()) )
+ {
+ mValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() );
+ }
+ }
+}
+
+Toolkit::ImageView ProgressBar::CreateTrack()
+{
+ Toolkit::ImageView track = Toolkit::ImageView::New();
+ track.SetParentOrigin( ParentOrigin::CENTER );
+ track.SetAnchorPoint( AnchorPoint::CENTER );
+ track.SetResizePolicy(ResizePolicy::USE_ASSIGNED_SIZE, Dimension::ALL_DIMENSIONS );
+
+ return track;
+}
+
+void ProgressBar::SetTrackVisual( const std::string& filename )
+{
+ if( mTrack && filename.size() > 0 )
+ {
+ mTrack.SetImage( filename );
+ mTrackVisual = filename;
+ mTrackVisualSize = Vector2::ZERO;
+ RelayoutRequest();
+ }
+}
+
+void ProgressBar::SetTrackVisual( Property::Map map )
+{
+ bool relayoutRequired = false;
+
+ Property::Value* imageValue = map.Find( "url" );
+ if( imageValue )
+ {
+ mTrackVisual.clear();
+ std::string filename;
+ if( imageValue->Get( filename ) )
+ {
+ if( mTrack && ( filename.size() > 0 ) )
+ {
+ mTrack.SetImage( filename );
+ mTrackMap = map;
+ relayoutRequired = true;
+ }
+ }
+ }
+
+ Property::Value* sizeValue = map.Find( "size" );
+ if( sizeValue )
+ {
+ Vector2 size;
+ if( sizeValue->Get( size ) )
+ {
+ mTrackVisualSize = size;
+ relayoutRequired = true;
+ }
+ }
+
+ // Visual and/or visual size changed so we need to relayout
+ if( relayoutRequired )
+ {
+ RelayoutRequest();
+ }
+}
+
+std::string ProgressBar::GetTrackVisual()
+{
+ return mTrackVisual;
+}
+
+Toolkit::ImageView ProgressBar::CreateProgress()
+{
+ Toolkit::ImageView progress = Toolkit::ImageView::New();
+ progress.SetParentOrigin( ParentOrigin::CENTER_LEFT );
+ progress.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
+ progress.SetResizePolicy(ResizePolicy::USE_ASSIGNED_SIZE, Dimension::ALL_DIMENSIONS );
+
+ return progress;
+}
+
+void ProgressBar::SetProgressVisual( const std::string& filename )
+{
+ if( mProgress && ( filename.size() > 0 ) )
+ {
+ mProgress.SetImage( filename );
+ mProgressVisual = filename;
+ mProgressVisualSize = Vector2::ZERO;
+ RelayoutRequest();
+ }
+}
+
+void ProgressBar::SetProgressVisual( Property::Map map )
+{
+ bool relayoutRequired = false;
+
+ Property::Value* imageValue = map.Find( "url" );
+ if( imageValue )
+ {
+ mProgressVisual.clear();
+ std::string filename;
+ if( imageValue->Get( filename ) )
+ {
+ if( mProgress && ( filename.size() > 0 ) )
+ {
+ mProgress.SetImage( filename );
+ mProgressMap = map;
+ relayoutRequired = true;
+ }
+ }
+ }
+
+ Property::Value* sizeValue = map.Find( "size" );
+ if( sizeValue )
+ {
+ Vector2 size;
+ if( sizeValue->Get( size ) )
+ {
+ mProgressVisualSize = size;
+ relayoutRequired = true;
+ }
+ }
+
+ // Visual and/or visual size changed so we need to relayout
+ if( relayoutRequired )
+ {
+ RelayoutRequest();
+ }
+}
+
+std::string ProgressBar::GetProgressVisual()
+{
+ return mProgressVisual;
+}
+
+Toolkit::ProgressBar::ValueChangedSignalType& ProgressBar::ValueChangedSignal()
+{
+ return mValueChangedSignal;
+}
+
+void ProgressBar::CreateChildren()
+{
+ Actor self = Self();
+
+ // Track
+ mTrack = CreateTrack();
+ self.Add( mTrack ); // Needs to be a direct child as we want to manipulate its size
+
+ // Progress bar
+ mProgress = CreateProgress();
+ self.Add( mProgress ); // Needs to be a direct child as we want to manipulate its size
+
+ // Value Text
+ mValueTextLabel = Toolkit::TextLabel::New();
+ mValueTextLabel.SetName( "ProgressBarValueTextLabel" );
+ mValueTextLabel.SetStyleName( "ProgressBarValueTextLabel" );
+ mValueTextLabel.SetParentOrigin( ParentOrigin::CENTER );
+ mValueTextLabel.SetAnchorPoint( AnchorPoint::CENTER );
+ mValueTextLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
+ mValueTextLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
+ mTrack.Add( mValueTextLabel ); // Add to mTrack and let it automatically set its size
+}
+
+void ProgressBar::SetProgressValue( float value )
+{
+ // update the progress bar value (taking float precision errors into account)
+ if( ( mValue != value ) &&
+ ( ( value >= DEFAULT_LOWER_BOUND ) || ( Equals( value, DEFAULT_LOWER_BOUND ) ) ) &&
+ ( ( value <= DEFAULT_UPPER_BOUND ) || ( Equals( value, DEFAULT_UPPER_BOUND ) ) ) )
+ {
+ mValue = Clamp( value, DEFAULT_LOWER_BOUND, DEFAULT_UPPER_BOUND );
+ DisplayValue( mValue, true );
+ RelayoutRequest();
+ }
+}
+
+float ProgressBar::GetProgressValue() const
+{
+ return mValue;
+}
+
+// Static class method to support script connecting signals
+bool ProgressBar::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ Dali::BaseHandle handle( object );
+
+ bool connected = true;
+ Toolkit::ProgressBar ProgressBar = Toolkit::ProgressBar::DownCast( handle );
+
+ if( 0 == strcmp( signalName.c_str(), SIGNAL_VALUE_CHANGED ) )
+ {
+ ProgressBar.ValueChangedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+void ProgressBar::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
+{
+ Toolkit::ProgressBar progressBar = Toolkit::ProgressBar::DownCast( Dali::BaseHandle( object ) );
+
+ if ( progressBar )
+ {
+ ProgressBar& progressBarImpl( GetImpl( progressBar ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::ProgressBar::Property::PROGRESS_VALUE:
+ {
+ progressBarImpl.SetProgressValue( value.Get< float >() );
+ break;
+ }
+
+ case Toolkit::ProgressBar::Property::TRACK_VISUAL:
+ {
+ Property::Map map;
+ if( value.Get( map ) )
+ {
+ progressBarImpl.SetTrackVisual( map );
+ }
+ break;
+ }
+
+ case Toolkit::ProgressBar::Property::PROGRESS_VISUAL:
+ {
+ Property::Map map;
+ if( value.Get( map ) )
+ {
+ progressBarImpl.SetProgressVisual( map );
+ }
+ break;
+ }
+ }
+ }
+}
+
+Property::Value ProgressBar::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Property::Value value;
+
+ Toolkit::ProgressBar progressBar = Toolkit::ProgressBar::DownCast( Dali::BaseHandle( object ) );
+
+ if ( progressBar )
+ {
+ ProgressBar& progressBarImpl( GetImpl( progressBar ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::ProgressBar::Property::PROGRESS_VALUE:
+ {
+ value = progressBarImpl.GetProgressValue();
+ break;
+ }
+
+ case Toolkit::ProgressBar::Property::TRACK_VISUAL:
+ {
+ if( !progressBarImpl.mTrackVisual.empty() )
+ {
+ value = progressBarImpl.GetTrackVisual();
+ }
+ else if( !progressBarImpl.mTrackMap.Empty() )
+ {
+ value = progressBarImpl.mTrackMap;
+ }
+ break;
+ }
+
+ case Toolkit::ProgressBar::Property::PROGRESS_VISUAL:
+ {
+ if( !progressBarImpl.mProgressVisual.empty() )
+ {
+ value = progressBarImpl.GetProgressVisual();
+ }
+ else if( !progressBarImpl.mProgressMap.Empty() )
+ {
+ value = progressBarImpl.mProgressMap;
+ }
+ break;
+ }
+ }
+ }
+
+ return value;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_PROGRESS_BAR_H
+#define DALI_TOOLKIT_INTERNAL_PROGRESS_BAR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/property-map.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+class ProgressBar;
+
+typedef Dali::IntrusivePtr< ProgressBar > ProgressBarPtr;
+
+/**
+ * @copydoc Toolkit::ProgressBar
+ */
+class ProgressBar : public Control
+{
+public:
+
+ /**
+ * Create a new ProgressBar.
+ *
+ * @return A public handle to the newly allocated ProgressBar.
+ */
+ static Dali::Toolkit::ProgressBar New();
+
+public:
+
+ // Properties
+
+ /**
+ * Set the value of the ProgressBar
+ *
+ * @param[in] value The value to set. Will be clamped to [lowerBound .. upperBound]
+ */
+
+ void SetProgressValue( float value );
+
+ /**
+ * Get the value of the ProgressBar
+ *
+ * @return The current value of the ProgressBar
+ */
+ float GetProgressValue() const;
+
+public:
+ //Signals
+
+ /**
+ * @copydoc Toolkit::ProgressBar::ValueChangedSignal()
+ */
+ Toolkit::ProgressBar::ValueChangedSignalType& ValueChangedSignal();
+
+ /**
+ * Connects a callback function with the object's signals.
+ * @param[in] object The object providing the signal.
+ * @param[in] tracker Used to disconnect the signal.
+ * @param[in] signalName The signal to connect to.
+ * @param[in] functor A newly allocated FunctorDelegate.
+ * @return True if the signal was connected.
+ * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+ */
+ static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName,
+ FunctorDelegate* functor );
+
+ // Properties
+
+ /**
+ * Called when a property of an object of this type is set.
+ * @param[in] object The object whose property is set.
+ * @param[in] index The property index.
+ * @param[in] value The new property value.
+ */
+ static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+
+ /**
+ * Called to retrieve a property of an object of this type.
+ * @param[in] object The object whose property is to be retrieved.
+ * @param[in] index The property index.
+ * @return The current value of the property.
+ */
+ static Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex );
+
+protected:
+
+ /**
+ * Construct a new ProgressBar.
+ */
+ ProgressBar();
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~ProgressBar();
+
+ /**
+ * @copydoc CustomActorImpl::OnRelayout()
+ */
+ virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+
+ /**
+ * @copydoc CustomActorImpl::GetNaturalSize()
+ */
+ virtual Vector3 GetNaturalSize();
+
+private:
+
+ /**
+ * Domain is a from/to pair
+ */
+ struct Domain
+ {
+ Vector2 from;
+ Vector2 to;
+
+ Domain()
+ {
+ }
+ Domain( Vector2 fromVal, Vector2 toVal )
+ : from( fromVal ), to( toVal )
+ {
+ }
+ };
+
+private:
+
+ /**
+ * @copydoc Toolkit::Control::OnInitialize()
+ */
+ virtual void OnInitialize();
+
+ /**
+ * Get the range of the valid values the ProgressBar handle can move between
+ *
+ * @param[in] currentSize The current size of the ProgressBar
+ * @return The range as a domain pair
+ */
+ Domain CalcDomain( const Vector2& currentSize );
+
+ /**
+ * Create the track for the ProgressBar
+ *
+ * @return The track actor
+ */
+ Toolkit::ImageView CreateTrack();
+
+ /**
+ * Create the progress track for the ProgressBar
+ *
+ * @return The track actor
+ */
+ Toolkit::ImageView CreateProgress();
+
+ /**
+ * Create all the children
+ */
+ void CreateChildren();
+
+ /**
+ * Set value choosing whether to fire signals or not
+ *
+ * @paramp[in] value The value to set
+ * @param[in] raiseSignals Configure signals to be raised or not.
+ */
+ void DisplayValue( float value, bool raiseSignals );
+
+ /**
+ * Create the image for the track
+ *
+ * @param[in] filename The track image
+ */
+ void SetTrackVisual( const std::string& filename );
+
+ /**
+ * @brief Set the track visual from an Dali::Property::Map
+ *
+ * @param[in] map The Dali::Property::Map to use for to display
+ */
+ void SetTrackVisual( Dali::Property::Map map );
+
+ /**
+ * @brief Return the track image.
+ *
+ * @return The track image.
+ */
+ std::string GetTrackVisual();
+
+ /**
+ * Create the image for the progress bar
+ *
+ * @param[in] filename The progress bar image
+ */
+ void SetProgressVisual( const std::string& filename );
+
+ /**
+ * @brief Set the progress visual from an Dali::Property::Map
+ *
+ * @param[in] map The Dali::Property::Map to use for to display
+ */
+ void SetProgressVisual( Dali::Property::Map map );
+
+ /**
+ * @brief Return the progress bar image.
+ *
+ * @return The progress bar image if it exists.
+ */
+ std::string GetProgressVisual();
+
+private:
+
+ // Undefined
+ ProgressBar( const ProgressBar& );
+
+ // Undefined
+ ProgressBar& operator=( const ProgressBar& rhs );
+
+private:
+
+ Domain mDomain; ///< Current domain of the handle
+
+ Toolkit::ImageView mTrack; ///< Track image
+ Toolkit::ImageView mProgress; ///< Progress bar
+ Toolkit::TextLabel mValueTextLabel; ///< Text value to show progress percentage
+ Toolkit::ProgressBar::ValueChangedSignalType mValueChangedSignal; ///< Signal emitted when the value is changed
+
+ std::string mTrackVisual; ///< Image for track image
+ std::string mProgressVisual; ///< Image for progress bar image
+
+ Property::Map mTrackMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+ Property::Map mProgressMap; ///< the Property::Map if the image came from a Property::Map, empty otherwise
+
+ Vector2 mTrackVisualSize; ///< Size of the track image used
+ Vector2 mProgressVisualSize; ///< Size of progress image used
+
+ float mValue; ///< Current value of ProgressBar
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Toolkit::Internal::ProgressBar& GetImpl( Toolkit::ProgressBar& pub )
+{
+ DALI_ASSERT_ALWAYS( pub );
+
+ Dali::RefObject& handle = pub.GetImplementation();
+
+ return static_cast< Toolkit::Internal::ProgressBar& >( handle );
+}
+
+inline const Toolkit::Internal::ProgressBar& GetImpl( const Toolkit::ProgressBar& pub )
+{
+ DALI_ASSERT_ALWAYS( pub );
+
+ const Dali::RefObject& handle = pub.GetImplementation();
+
+ return static_cast< const Toolkit::Internal::ProgressBar& >( handle );
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_PROGRESS_BAR_H
DALI_ACTION_REGISTRATION( Toolkit, ItemView, "stopScrolling", ACTION_STOP_SCROLLING )
+DALI_ACTION_REGISTRATION( Toolkit, ItemView, "enableRefresh", ACTION_ENABLE_REFRESH )
+DALI_ACTION_REGISTRATION( Toolkit, ItemView, "disableRefresh", ACTION_DISABLE_REFRESH )
+
DALI_TYPE_REGISTRATION_END()
bool FindById( const ItemContainer& items, ItemId id )
mIsFlicking(false),
mAddingItems(false),
mRefreshEnabled(true),
+ mRefreshNotificationEnabled(true),
mInAnimation(false)
{
}
void ItemView::OnRefreshNotification(PropertyNotification& source)
{
- // Cancel scroll animation to prevent any fighting of setting the scroll position property by scroll bar during fast scroll.
- if(!mRefreshEnabled && mScrollAnimation)
+ if( mRefreshNotificationEnabled )
{
- RemoveAnimation(mScrollAnimation);
- }
+ // Cancel scroll animation to prevent any fighting of setting the scroll position property by scroll bar during fast scroll.
+ if(!mRefreshEnabled && mScrollAnimation)
+ {
+ RemoveAnimation(mScrollAnimation);
+ }
- // Only cache extra items when it is not a fast scroll
- DoRefresh(GetCurrentLayoutPosition(0), mRefreshEnabled || mScrollAnimation);
+ // Only cache extra items when it is not a fast scroll
+ DoRefresh(GetCurrentLayoutPosition(0), mRefreshEnabled || mScrollAnimation);
+ }
}
void ItemView::Refresh()
{
GetImpl( itemView ).DoStopScrolling();
}
+ else if ( 0 == strcmp( actionName.c_str(), ACTION_ENABLE_REFRESH ) )
+ {
+ GetImpl( itemView ).SetRefreshNotificationEnabled( true );
+ }
+ else if ( 0 == strcmp( actionName.c_str(), ACTION_DISABLE_REFRESH ) )
+ {
+ GetImpl( itemView ).SetRefreshNotificationEnabled( false );
+ }
return true;
}
}
}
+void ItemView::SetRefreshNotificationEnabled( bool enabled )
+{
+ mRefreshNotificationEnabled = enabled;
+}
+
} // namespace Internal
} // namespace Toolkit
*/
void DoStopScrolling();
+ /**
+ * Helper for DoAction( ACTION_ENABLE/DISABLE_REFRESH_NOTIFICATIONS ).
+ * @param[in] enabled Whether to disable refresh notifications or not.
+ */
+ void SetRefreshNotificationEnabled( bool enabled );
+
private:
/**
bool mIsFlicking : 1;
bool mAddingItems : 1;
bool mRefreshEnabled : 1; ///< Whether to refresh the cache automatically
+ bool mRefreshNotificationEnabled : 1; ///< Whether to disable refresh notifications or not.
bool mInAnimation : 1; ///< Keeps track of whether an animation is controlling the overshoot property.
};
// Position Delta ///////////////////////////////////////////////////////
if(positionChanged)
{
+ UpdateMainInternalConstraint();
if(mWrapMode && findShortcuts)
{
// In Wrap Mode, the shortest distance is a little less intuitive...
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
const float VALUE_POPUP_MARGIN = 10.0f;
const float VALUE_POPUP_HEIGHT = 81.0f;
const float VALUE_POPUP_MIN_WIDTH = 54.0f;
-const Vector2 VALUE_POPUP_ARROW_SIZE( 18.0f, 18.0f );
const float DEFAULT_LOWER_BOUND = 0.0f;
const float DEFAULT_UPPER_BOUND = 1.0f;
void Slider::OnSizeSet( const Vector3& size )
{
- // Factor in handle overshoot into size of track
+}
+
+void Slider::OnRelayout( const Vector2& size, RelayoutContainer& container )
+{
SetHitRegion( Vector2( size.x, GetHitRegion().y ) );
+ // Factor in handle overshoot into size of backing
SetTrackRegion( Vector2( size.x - GetHandleSize().x, GetTrackRegion().y ) );
+ Control::OnRelayout( size, container );
}
bool Slider::OnTouch(Actor actor, const TouchData& touch)
void Slider::DisplayValue( float value, bool raiseSignals )
{
- float clampledValue = Clamp( value, GetLowerBound(), GetUpperBound() );
+ float clampedValue = Clamp( value, GetLowerBound(), GetUpperBound() );
- float percent = MapValuePercentage( clampledValue );
+ float percent = MapValuePercentage( clampedValue );
float x = mDomain.from.x + percent * ( mDomain.to.x - mDomain.from.x );
if( raiseSignals )
{
Toolkit::Slider self = Toolkit::Slider::DownCast( Self() );
- mValueChangedSignal.Emit( self, clampledValue );
+ mValueChangedSignal.Emit( self, clampedValue );
int markIndex;
if( MarkReached( percent, markIndex ) )
{
std::stringstream ss;
ss.precision( GetValuePrecision() );
- ss << std::fixed << clampledValue;
+ ss << std::fixed << clampedValue;
- mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() );
+ std::string label = mHandleValueTextLabel.GetProperty<std::string>( Toolkit::TextLabel::Property::TEXT );
+ if( label.compare(ss.str()) )
+ {
+ mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::TEXT, ss.str() );
+ }
}
}
Toolkit::ImageView Slider::CreateTrack()
{
Toolkit::ImageView track = Toolkit::ImageView::New();
+ track.SetName("SliderTrack");
track.SetParentOrigin( ParentOrigin::CENTER );
track.SetAnchorPoint( AnchorPoint::CENTER );
-
return track;
}
Toolkit::ImageView Slider::CreateProgress()
{
Toolkit::ImageView progress = Toolkit::ImageView::New();
+ progress.SetName("SliderProgress");
progress.SetParentOrigin( ParentOrigin::CENTER_LEFT );
progress.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
Toolkit::ImageView Slider::CreateHandle()
{
Toolkit::ImageView handle = Toolkit::ImageView::New();
+ handle.SetName("SliderHandle");
handle.SetParentOrigin( ParentOrigin::CENTER_LEFT );
handle.SetAnchorPoint( AnchorPoint::CENTER );
Toolkit::ImageView Slider::CreatePopupArrow()
{
Toolkit::ImageView arrow = Toolkit::ImageView::New();
+ arrow.SetStyleName("SliderPopupArrow");
+ arrow.SetName("SliderPopupArrow");
arrow.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
arrow.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
Toolkit::TextLabel Slider::CreatePopupText()
{
Toolkit::TextLabel textLabel = Toolkit::TextLabel::New();
+ textLabel.SetName( "SliderPopupTextLabel" );
+ textLabel.SetStyleName( "SliderPopupTextLabel" );
textLabel.SetParentOrigin( ParentOrigin::CENTER );
textLabel.SetAnchorPoint( AnchorPoint::CENTER );
textLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
Toolkit::ImageView Slider::CreatePopup()
{
Toolkit::ImageView popup = Toolkit::ImageView::New();
+ popup.SetName( "SliderPopup" );
popup.SetParentOrigin( ParentOrigin::TOP_CENTER );
popup.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
popup.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::WIDTH );
if( mHandle && !mHandleValueTextLabel )
{
mHandleValueTextLabel = Toolkit::TextLabel::New();
+ mHandleValueTextLabel.SetName("SliderHandleTextLabel");
+ mHandleValueTextLabel.SetStyleName("SliderHandleTextLabel");
mHandleValueTextLabel.SetParentOrigin( ParentOrigin::CENTER );
mHandleValueTextLabel.SetAnchorPoint( AnchorPoint::CENTER );
mHandleValueTextLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
*/
virtual void OnSizeSet( const Vector3& size );
+ /**
+ * @copydoc CustomActorImpl::OnRelayout
+ */
+ virtual void OnRelayout( const Vector2& size, RelayoutContainer& container );
+
+
private:
/**
{
float exponent = static_cast<float>(i);
mBlurredImage[i-1] = FrameBufferImage::New( mTargetSize.width/std::pow(2.f,exponent) , mTargetSize.height/std::pow(2.f,exponent),
- GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT, Dali::Image::NEVER );
+ GAUSSIAN_BLUR_RENDER_TARGET_PIXEL_FORMAT );
InitializeVisual( self, mVisuals[i], mBlurredImage[i - 1] );
mVisuals[ i ].SetDepthIndex( i );
SetShaderEffect( mVisuals[ i ] );
#define __DALI_TOOLKIT_INTERNAL_SUPER_BLUR_VIEW_H__
/*
- * Copyright (c) 2014 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.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h>
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
namespace Dali
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", STRING, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
+DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
DALI_TYPE_REGISTRATION_END()
{
editor.TextChangedSignal().Connect( tracker, functor );
}
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_INPUT_STYLE_CHANGED ) )
+ {
+ editor.InputStyleChangedSignal().Connect( tracker, functor );
+ }
else
{
// signalName does not match any signal
return mTextChangedSignal;
}
+Toolkit::TextEditor::InputStyleChangedSignalType& TextEditor::InputStyleChangedSignal()
+{
+ return mInputStyleChangedSignal;
+}
+
void TextEditor::OnInitialize()
{
Actor self = Self();
case StyleChange::DEFAULT_FONT_SIZE_CHANGE:
{
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor::OnStyleChange StyleChange::DEFAULT_FONT_SIZE_CHANGE (%f)\n", mController->GetDefaultPointSize() );
-
- if ( (mController->GetDefaultPointSize() <= 0.0f) ) // If DefaultPointSize not set by Property system it will be 0.0f
- {
- // Property system did not set the PointSize so should update it.
- // todo instruct text-controller to update model
- }
+ GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
break;
}
case StyleChange::THEME_CHANGE:
EnableClipping( true, size );
RenderText( updateTextType );
}
+
+ // The text-editor emits signals when the input style changes. These changes of style are
+ // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+ // can't be emitted during the size negotiation as the callbacks may update the UI.
+ // The text-editor adds an idle callback to the adaptor to emit the signals after the size negotiation.
+ if( !mController->IsInputStyleChangedSignalsQueueEmpty() )
+ {
+ if( Adaptor::IsAvailable() )
+ {
+ Adaptor& adaptor = Adaptor::Get();
+
+ if( NULL == mIdleCallback )
+ {
+ // @note: The callback manager takes the ownership of the callback object.
+ mIdleCallback = MakeCallback( this, &TextEditor::OnIdleSignal );
+ adaptor.AddIdle( mIdleCallback );
+ }
+ }
+ }
}
void TextEditor::RenderText( Text::Controller::UpdateTextType updateTextType )
mTextChangedSignal.Emit( handle );
}
+void TextEditor::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )
+{
+ Dali::Toolkit::TextEditor handle( GetOwner() );
+
+ Toolkit::TextEditor::InputStyle::Mask editorInputStyleMask = Toolkit::TextEditor::InputStyle::NONE;
+
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_COLOR ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::COLOR );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_FAMILY ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_FAMILY );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_POINT_SIZE ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::POINT_SIZE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_WEIGHT ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_WIDTH ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_SLANT ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::FONT_STYLE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_LINE_SPACING ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::LINE_SPACING );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_UNDERLINE ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::UNDERLINE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_SHADOW ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::SHADOW );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_EMBOSS ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::EMBOSS );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_OUTLINE ) )
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>( editorInputStyleMask | Toolkit::TextEditor::InputStyle::OUTLINE );
+ }
+
+ mInputStyleChangedSignal.Emit( handle, editorInputStyleMask );
+}
+
void TextEditor::MaxLengthReached()
{
// Nothing to do as TextEditor doesn't emit a max length reached signal.
return true;
}
+void TextEditor::OnIdleSignal()
+{
+ // Emits the change of input style signals.
+ mController->ProcessInputStyleChangedSignals();
+
+ // Set the pointer to null as the callback manager deletes the callback after execute it.
+ mIdleCallback = NULL;
+}
+
TextEditor::TextEditor()
: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+ mIdleCallback( NULL ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
mHasBeenStaged( false )
{
TextEditor::~TextEditor()
{
mClipper.Reset();
+
+ if( ( NULL != mIdleCallback ) && Adaptor::IsAvailable() )
+ {
+ // Removes the callback from the callback manager in case the text-editor is destroyed before the callback is executed.
+ Adaptor::Get().RemoveIdle( mIdleCallback );
+ }
}
} // namespace Internal
*/
Toolkit::TextEditor::TextChangedSignalType& TextChangedSignal();
+ /**
+ * @copydoc TextEditor::TextChangedSignal()
+ */
+ Toolkit::TextEditor::InputStyleChangedSignalType& InputStyleChangedSignal();
+
private: // From Control
/**
*/
virtual void MaxLengthReached();
+ /**
+ * @copydoc Text::ControlInterface::InputStyleChanged()
+ */
+ virtual void InputStyleChanged( Text::InputStyle::Mask inputStyleMask );
+
private: // Implementation
/**
*/
bool OnTouched( Actor actor, const TouchData& touch );
+ /**
+ * @brief Callbacks called on idle.
+ *
+ * If there are notifications of change of input style on the queue, Toolkit::TextEditor::InputStyleChangedSignal() are emitted.
+ */
+ void OnIdleSignal();
+
/**
* Construct a new TextEditor.
*/
// Signals
Toolkit::TextEditor::TextChangedSignalType mTextChangedSignal;
+ Toolkit::TextEditor::InputStyleChangedSignalType mInputStyleChangedSignal;
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
Actor mRenderableActor;
+ CallbackBase* mIdleCallback;
int mRenderingBackend;
bool mHasBeenStaged:1;
/*
- * 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/images/resource-image.h>
#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
+DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
DALI_TYPE_REGISTRATION_END()
const std::string text = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetPlaceholderText( PLACEHOLDER_TYPE_INACTIVE, text );
+ impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
}
break;
}
const std::string text = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetPlaceholderText( PLACEHOLDER_TYPE_ACTIVE, text );
+ impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
}
break;
}
if( impl.mController )
{
std::string text;
- impl.mController->GetPlaceholderText( PLACEHOLDER_TYPE_INACTIVE, text );
+ impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
value = text;
}
break;
if( impl.mController )
{
std::string text;
- impl.mController->GetPlaceholderText( PLACEHOLDER_TYPE_ACTIVE, text );
+ impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
value = text;
}
break;
{
field.MaxLengthReachedSignal().Connect( tracker, functor );
}
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_INPUT_STYLE_CHANGED ) )
+ {
+ field.InputStyleChangedSignal().Connect( tracker, functor );
+ }
else
{
// signalName does not match any signal
return mMaxLengthReachedSignal;
}
+Toolkit::TextField::InputStyleChangedSignalType& TextField::InputStyleChangedSignal()
+{
+ return mInputStyleChangedSignal;
+}
+
void TextField::OnInitialize()
{
Actor self = Self();
case StyleChange::DEFAULT_FONT_SIZE_CHANGE:
{
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField::OnStyleChange StyleChange::DEFAULT_FONT_SIZE_CHANGE (%f)\n", mController->GetDefaultPointSize() );
-
- if ( (mController->GetDefaultPointSize() <= 0.0f) ) // If DefaultPointSize not set by Property system it will be 0.0f
- {
- // Property system did not set the PointSize so should update it.
- // todo instruct text-controller to update model
- }
+ GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
break;
}
case StyleChange::THEME_CHANGE:
EnableClipping( ( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP == mExceedPolicy ), size );
RenderText( updateTextType );
}
+
+ // The text-field emits signals when the input style changes. These changes of style are
+ // detected during the relayout process (size negotiation), i.e after the cursor has been moved. Signals
+ // can't be emitted during the size negotiation as the callbacks may update the UI.
+ // The text-field adds an idle callback to the adaptor to emit the signals after the size negotiation.
+ if( !mController->IsInputStyleChangedSignalsQueueEmpty() )
+ {
+ if( Adaptor::IsAvailable() )
+ {
+ Adaptor& adaptor = Adaptor::Get();
+
+ if( NULL == mIdleCallback )
+ {
+ // @note: The callback manager takes the ownership of the callback object.
+ mIdleCallback = MakeCallback( this, &TextField::OnIdleSignal );
+ adaptor.AddIdle( mIdleCallback );
+ }
+ }
+ }
}
-void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
+ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType )
{
Actor self = Self();
Actor renderableActor;
mTextChangedSignal.Emit( handle );
}
+void TextField::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )
+{
+ Dali::Toolkit::TextField handle( GetOwner() );
+
+ Toolkit::TextField::InputStyle::Mask fieldInputStyleMask = Toolkit::TextField::InputStyle::NONE;
+
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_COLOR ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::COLOR );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_FAMILY ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_FAMILY );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_POINT_SIZE ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::POINT_SIZE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_WEIGHT ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_STYLE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_WIDTH ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_STYLE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_FONT_SLANT ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::FONT_STYLE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_UNDERLINE ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::UNDERLINE );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_SHADOW ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::SHADOW );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_EMBOSS ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::EMBOSS );
+ }
+ if( InputStyle::NONE != static_cast<InputStyle::Mask>( inputStyleMask & InputStyle::INPUT_OUTLINE ) )
+ {
+ fieldInputStyleMask = static_cast<Toolkit::TextField::InputStyle::Mask>( fieldInputStyleMask | Toolkit::TextField::InputStyle::OUTLINE );
+ }
+
+ mInputStyleChangedSignal.Emit( handle, fieldInputStyleMask );
+}
+
void TextField::OnStageConnect( Dali::Actor actor )
{
if ( mHasBeenStaged )
return true;
}
+void TextField::OnIdleSignal()
+{
+ // Emits the change of input style signals.
+ mController->ProcessInputStyleChangedSignals();
+
+ // Set the pointer to null as the callback manager deletes the callback after execute it.
+ mIdleCallback = NULL;
+}
+
TextField::TextField()
: Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ),
+ mIdleCallback( NULL ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
mExceedPolicy( Dali::Toolkit::TextField::EXCEED_POLICY_CLIP ),
mHasBeenStaged( false )
TextField::~TextField()
{
mClipper.Reset();
+
+ if( ( NULL != mIdleCallback ) && Adaptor::IsAvailable() )
+ {
+ Adaptor::Get().RemoveIdle( mIdleCallback );
+ }
}
} // namespace Internal
#define __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_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.
*/
Toolkit::TextField::MaxLengthReachedSignalType& MaxLengthReachedSignal();
+ /**
+ * @copydoc TextField::TextChangedSignal()
+ */
+ Toolkit::TextField::InputStyleChangedSignalType& InputStyleChangedSignal();
+
private: // From Control
/**
*/
virtual void MaxLengthReached();
+ /**
+ * @copydoc Text::ControlInterface::InputStyleChanged()
+ */
+ virtual void InputStyleChanged( Text::InputStyle::Mask inputStyleMask );
+
private: // Implementation
/**
*/
bool OnTouched( Actor actor, const TouchData& touch );
+ /**
+ * @brief Callbacks called on idle.
+ *
+ * If there are notifications of change of input style on the queue, Toolkit::TextField::InputStyleChangedSignal() are emitted.
+ */
+ void OnIdleSignal();
+
/**
* Construct a new TextField.
*/
// Signals
Toolkit::TextField::TextChangedSignalType mTextChangedSignal;
Toolkit::TextField::MaxLengthReachedSignalType mMaxLengthReachedSignal;
+ Toolkit::TextField::InputStyleChangedSignalType mInputStyleChangedSignal;
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
Actor mRenderableActor;
+ CallbackBase* mIdleCallback;
int mRenderingBackend;
int mExceedPolicy;
/*
- * 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.
case StyleChange::DEFAULT_FONT_SIZE_CHANGE:
{
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnStyleChange StyleChange::DEFAULT_FONT_SIZE_CHANGE (%f)\n", mController->GetDefaultPointSize() );
-
- if ( (mController->GetDefaultPointSize() <= 0.0f) ) // If DefaultPointSize not set by Property system it will be 0.0f
- {
- // Property system did not set the PointSize so should update it.
- // todo instruct text-controller to update model
- }
+ GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
break;
}
case StyleChange::THEME_CHANGE:
void TextLabel::TextChanged()
{
- // TextLabel does not provide a signal for this
+ // TextLabel does not provide a signal for this.
}
void TextLabel::MaxLengthReached()
// Pure Virtual from TextController Interface, only needed when inputting text
}
+void TextLabel::InputStyleChanged( Text::InputStyle::Mask inputStyleMask )
+{
+ // TextLabel does not provide a signal for this.
+}
+
void TextLabel::ScrollingFinished()
{
// Pure Virtual from TextScroller Interface
#define __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_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.
*/
virtual void MaxLengthReached();
+ /**
+ * @copydoc Text::ControlInterface::InputStyleChanged()
+ */
+ virtual void InputStyleChanged( Text::InputStyle::Mask inputStyleMask );
+
private: // from TextScroller
/**
/*
- * 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 <libintl.h>
#include <cfloat>
#include <dali/public-api/animation/animation.h>
-#include <dali/public-api/images/nine-patch-image.h>
+#include <dali/devel-api/images/nine-patch-image.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/math/vector4.h>
// todo Move this to adaptor??
#define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
-const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME( "textselectionpopupbutton" );
+const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME( "TextSelectionPopupButton" );
const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR( Dali::Vector4( 0.24f, 0.72f, 0.8f, 1.0f ) );
#if defined(DEBUG_ENABLED)
Actor self = Self();
self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
self.SetProperty( Actor::Property::COLOR_ALPHA, 0.0f );
+
+ // The Popup Control background is a nine-patch image. We clip against this so the
+ // contents are correctly clipped against the edges of the nine-patch.
+ self.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
}
void TextSelectionPopup::OnStageConnection( int depth )
} // namespace Toolkit
} // namespace Dali
-
-
/*
- * 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.
void TextSelectionToolbar::SetPopupMaxSize( const Size& maxSize )
{
mMaxSize = maxSize;
- if (mScrollView && mStencilLayer )
+ if (mScrollView && mToolbarLayer )
{
mScrollView.SetMaximumSize( mMaxSize );
- mStencilLayer.SetMaximumSize( mMaxSize );
+ mToolbarLayer.SetMaximumSize( mMaxSize );
}
}
void TextSelectionToolbar::SetUp()
{
Actor self = Self();
- self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
- // Create Layer and Stencil. Layer enable's clipping when content exceed maximum defined width.
- mStencilLayer = Layer::New();
- mStencilLayer.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
- mStencilLayer.SetParentOrigin( ParentOrigin::CENTER );
+ self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
- BufferImage stencilImage = BufferImage::WHITE(); // ImageView needs an Image or does nothing
- Toolkit::ImageView stencil = Toolkit::ImageView::New(stencilImage);
- stencil.SetDrawMode( DrawMode::STENCIL );
- stencil.SetVisible( true );
- stencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- stencil.SetParentOrigin( ParentOrigin::CENTER );
+ // Create Layer to house the toolbar.
+ mToolbarLayer = Layer::New();
+ mToolbarLayer.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+ mToolbarLayer.SetAnchorPoint( AnchorPoint::CENTER );
+ mToolbarLayer.SetParentOrigin( ParentOrigin::CENTER );
- if ( !mScrollView )
+ if( !mScrollView )
{
- mScrollView = Toolkit::ScrollView::New();
+ mScrollView = Toolkit::ScrollView::New();
}
SetUpScrollView();
mTableOfButtons.SetParentOrigin( ParentOrigin::CENTER_LEFT );
mTableOfButtons.SetAnchorPoint( AnchorPoint::CENTER_LEFT );
- mStencilLayer.Add( stencil );
- mStencilLayer.Add( mScrollView );
mScrollView.Add( mTableOfButtons );
- self.Add( mStencilLayer );
+ mToolbarLayer.Add( mScrollView );
+
+ self.Add( mToolbarLayer );
}
void TextSelectionToolbar::OnScrollStarted( const Vector2& position )
void TextSelectionToolbar::RaiseAbove( Layer target )
{
- mStencilLayer.RaiseAbove( target );
+ mToolbarLayer.RaiseAbove( target );
}
void TextSelectionToolbar::ConfigureScrollview( const Property::Map& properties )
-#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__
-#define __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__
+#ifndef DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
+#define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_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.
private: // Data
- Layer mStencilLayer; ///< The stencil layer
+ Layer mToolbarLayer; ///< The layer used to house the toolbar.
Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor
Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit.
RulerPtr mRulerX; ///< Ruler to clamp horizontal scrolling. Updates on Relayout
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H__
+#endif // DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_TOOLBAR_H
$(toolkit_src_dir)/visuals/visual-string-constants.cpp \
$(toolkit_src_dir)/visuals/border/border-visual.cpp \
$(toolkit_src_dir)/visuals/color/color-visual.cpp \
- $(toolkit_src_dir)/visuals/debug/debug-visual.cpp \
- $(toolkit_src_dir)/visuals/image/image-visual.cpp \
- $(toolkit_src_dir)/visuals/npatch/npatch-visual.cpp \
$(toolkit_src_dir)/visuals/gradient/gradient.cpp \
$(toolkit_src_dir)/visuals/gradient/linear-gradient.cpp \
$(toolkit_src_dir)/visuals/gradient/radial-gradient.cpp \
$(toolkit_src_dir)/visuals/gradient/gradient-visual.cpp \
- $(toolkit_src_dir)/visuals/svg/svg-rasterize-thread.cpp \
- $(toolkit_src_dir)/visuals/svg/svg-visual.cpp \
+ $(toolkit_src_dir)/visuals/image/batch-image-visual.cpp \
+ $(toolkit_src_dir)/visuals/image/image-visual.cpp \
$(toolkit_src_dir)/visuals/mesh/mesh-visual.cpp \
+ $(toolkit_src_dir)/visuals/npatch/npatch-visual.cpp \
$(toolkit_src_dir)/visuals/primitive/primitive-visual.cpp \
- $(toolkit_src_dir)/visuals/image/batch-image-visual.cpp \
+ $(toolkit_src_dir)/visuals/svg/svg-rasterize-thread.cpp \
+ $(toolkit_src_dir)/visuals/svg/svg-visual.cpp \
+ $(toolkit_src_dir)/visuals/wireframe/wireframe-visual.cpp \
$(toolkit_src_dir)/controls/alignment/alignment-impl.cpp \
$(toolkit_src_dir)/controls/bloom-view/bloom-view-impl.cpp \
$(toolkit_src_dir)/controls/bubble-effect/bubble-emitter-impl.cpp \
$(toolkit_src_dir)/controls/page-turn-view/page-turn-effect.cpp \
$(toolkit_src_dir)/controls/page-turn-view/page-turn-landscape-view-impl.cpp \
$(toolkit_src_dir)/controls/page-turn-view/page-turn-view-impl.cpp \
+ $(toolkit_src_dir)/controls/progress-bar/progress-bar-impl.cpp \
$(toolkit_src_dir)/controls/scroll-bar/scroll-bar-impl.cpp \
$(toolkit_src_dir)/controls/scrollable/bouncing-effect-actor.cpp \
$(toolkit_src_dir)/controls/scrollable/item-view/depth-layout.cpp \
mActorForInput.SetSize( mTargetSize );
// create internal offscreen for result of horizontal pass
- mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
+ mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
// create an actor to render mImageForHorz for vertical blur pass
mActorForHorz = Toolkit::ImageView::New( mImageForHorz );
mActorForHorz.SetParentOrigin( ParentOrigin::CENTER );
mActorForHorz.SetSize( mTargetSize );
// create internal offscreen for result of the two pass blurred image
- mBlurredImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED);
+ mBlurredImage = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
// create an actor to blend the blurred image and the input image with the given blur strength
mActorForBlending.SetImage( mBlurredImage );
mActorForBlending.SetParentOrigin( ParentOrigin::CENTER );
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Dali
{
void EmbossFilter::Enable()
{
- mImageForEmboss1 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
- mImageForEmboss2 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
+ mImageForEmboss1 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
+ mImageForEmboss2 = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EMBOSS_FRAGMENT_SOURCE;
mActorForComposite.SetColor( Color::BLACK );
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
- visualMap[ Toolkit::Visual::Property::SHADER ] = customShader;
- visualMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE;
mRootActor.Add( mActorForComposite );
- InitializeVisual( mActorForComposite, mVisualForEmboss1, visualMap );
- InitializeVisual( mActorForComposite, mVisualForEmboss2, visualMap );
+ Image dummyImage; // Dummy image, force creation of an image visual
+
+ InitializeVisual( mActorForComposite, mVisualForEmboss1, dummyImage );
+ Toolkit::GetImplementation( mVisualForEmboss1 ).SetCustomShader( customShader );
+
+ InitializeVisual( mActorForComposite, mVisualForEmboss2, dummyImage );
+ Toolkit::GetImplementation( mVisualForEmboss2 ).SetCustomShader( customShader );
TextureSet textureSet1 = TextureSet::New();
TextureSetImage( textureSet1, 0, mImageForEmboss1 );
mActorForInput.RegisterProperty( TEX_SCALE_UNIFORM_NAME, Vector2( 1.0f / mTargetSize.width, 0.0f ) );
// create internal offscreen for result of horizontal pass
- mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat, Image::UNUSED );
+ mImageForHorz = FrameBufferImage::New( mTargetSize.width, mTargetSize.height, mPixelFormat );
// create an actor to render mImageForHorz for vertical blur pass
mActorForHorz = Toolkit::ImageView::New( mImageForHorz );
mActorForHorz.SetParentOrigin( ParentOrigin::CENTER );
/*
- * Copyright (c) 2014 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.
KeyboardFocusManager::KeyboardFocusManager()
: mCurrentFocusActor(0),
- mFocusIndicatorActor(Actor()),
+ mFocusIndicatorActor(),
mFocusGroupLoopEnabled(false),
mIsKeyboardFocusEnabled(false),
mIsFocusIndicatorEnabled(false),
mIsWaitingKeyboardFocusChangeCommit(false),
mSlotDelegate(this)
{
- CreateDefaultFocusIndicatorActor();
-
OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
{
mIsFocusIndicatorEnabled = true;
// Draw the focus indicator upon the focused actor
- if( mFocusIndicatorActor )
- {
- actor.Add( mFocusIndicatorActor );
- }
+ actor.Add( GetFocusIndicatorActor() );
// Send notification for the change of focus actor
if( !mFocusChangedSignal.Empty() )
Actor KeyboardFocusManager::GetFocusIndicatorActor()
{
- return mFocusIndicatorActor;
-}
-
-void KeyboardFocusManager::CreateDefaultFocusIndicatorActor()
-{
- // Create a focus indicator actor shared by all the keyboard focusable actors
- Toolkit::ImageView focusIndicator = Toolkit::ImageView::New(FOCUS_BORDER_IMAGE_PATH);
- focusIndicator.SetParentOrigin( ParentOrigin::CENTER );
+ if( ! mFocusIndicatorActor )
+ {
+ // Create the default if it hasn't been set and one that's shared by all the keyboard focusable actors
+ mFocusIndicatorActor = Toolkit::ImageView::New( FOCUS_BORDER_IMAGE_PATH );
+ mFocusIndicatorActor.SetParentOrigin( ParentOrigin::CENTER );
- // Apply size constraint to the focus indicator
- focusIndicator.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ // Apply size constraint to the focus indicator
+ mFocusIndicatorActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
+ }
- SetFocusIndicatorActor(focusIndicator);
+ return mFocusIndicatorActor;
}
void KeyboardFocusManager::OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard)
Actor actor = GetCurrentFocusActor();
if(actor)
{
- if(mFocusIndicatorActor)
- {
- actor.Add(mFocusIndicatorActor);
- }
+ actor.Add( GetFocusIndicatorActor() );
}
mIsFocusIndicatorEnabled = true;
}
{
// Hide indicator when keyboard focus turned off
Actor actor = GetCurrentFocusActor();
- if(actor)
+ if( actor && mFocusIndicatorActor )
{
- actor.Remove(mFocusIndicatorActor);
+ actor.Remove( mFocusIndicatorActor );
}
mIsFocusIndicatorEnabled = false;
}
if(isFocusStartableKey && mIsFocusIndicatorEnabled && !isAccessibilityEnabled)
{
Actor actor = GetCurrentFocusActor();
- if( !actor )
+ if( actor )
+ {
+ // Make sure the focused actor is highlighted
+ actor.Add( GetFocusIndicatorActor() );
+ }
+ else
{
// No actor is focused but keyboard focus is activated by the key press
// Let's try to move the initial focus
MoveFocus(Toolkit::Control::KeyboardFocus::RIGHT);
}
- else if(mFocusIndicatorActor)
- {
- // Make sure the focused actor is highlighted
- actor.Add(mFocusIndicatorActor);
- }
}
}
#define __DALI_TOOLKIT_INTERNAL_KEYBOARD_FOCUS_MANAGER_H__
/*
- * Copyright (c) 2014 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.
*/
void DoKeyboardEnter( Actor actor );
- /**
- * Create the default indicator actor to highlight the focused actor.
- */
- void CreateDefaultFocusIndicatorActor();
-
/**
* Check whether the actor is a layout control that supports two dimensional keyboard navigation.
* The layout control needs to internally set the focus order for the child actor and be able to
/*
- * Copyright (c) 2014 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/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/adaptor-framework/application.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control.h>
const char* LANDSCAPE_QUALIFIER = "landscape";
const char* PORTRAIT_QUALIFIER = "portrait";
-const char* FONT_SIZE_QUALIFIER = "FontSize";
+const char* FONT_SIZE_QUALIFIER = "fontsize";
const char* DEFAULT_THEME = DALI_STYLE_DIR "dali-toolkit-default-theme.json";
const char* PACKAGE_PATH_KEY = "PACKAGE_PATH";
+const char* APPLICATION_RESOURCE_PATH_KEY = "APPLICATION_RESOURCE_PATH";
+
const char* DEFAULT_PACKAGE_PATH = DALI_DATA_READ_ONLY_DIR "/toolkit/";
} // namespace
{
// Add theme builder constants
mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH;
+ mThemeBuilderConstants[ APPLICATION_RESOURCE_PATH_KEY ] = Application::GetResourcePath();
mStyleMonitor = StyleMonitor::Get();
if( mStyleMonitor )
{
mStyleMonitor.StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange );
-
mDefaultFontSize = mStyleMonitor.GetDefaultFontSize();
}
if( styleName.empty() )
{
- // Convert control name to lower case
styleName = control.GetTypeName();
- std::transform( styleName.begin(), styleName.end(), styleName.begin(), ::tolower );
}
// Apply the style after choosing the correct actual style (e.g. landscape or portrait)
#define __DALI_TOOLKIT_TEXT_INPUT_STYLE_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.
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/common/constants.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/text-definitions.h>
*/
struct InputStyle
{
+ enum Mask
+ {
+ NONE = 0x0000,
+ INPUT_COLOR = 0x0001,
+ INPUT_FONT_FAMILY = 0x0002,
+ INPUT_POINT_SIZE = 0x0004,
+ INPUT_FONT_WEIGHT = 0x0008,
+ INPUT_FONT_WIDTH = 0x0010,
+ INPUT_FONT_SLANT = 0x0020,
+ INPUT_LINE_SPACING = 0x0040,
+ INPUT_UNDERLINE = 0x0080,
+ INPUT_SHADOW = 0x0100,
+ INPUT_EMBOSS = 0x0200,
+ INPUT_OUTLINE = 0x0400
+ };
+
InputStyle()
: textColor( Color::BLACK ),
- fontStyle(),
familyName(),
weight( TextAbstraction::FontWeight::NORMAL ),
width( TextAbstraction::FontWidth::NORMAL ),
embossProperties(),
outlineProperties(),
isDefaultColor( true ),
- familyDefined( false ),
- weightDefined( false ),
- widthDefined( false ),
- slantDefined( false ),
- sizeDefined( false ),
- lineSpacingDefined( false )
- {}
+ isFamilyDefined( false ),
+ isWeightDefined( false ),
+ isWidthDefined( false ),
+ isSlantDefined( false ),
+ isSizeDefined( false ),
+ isLineSpacingDefined( false ),
+ isUnderlineDefined( false ),
+ isShadowDefined( false ),
+ isEmbossDefined( false ),
+ isOutlineDefined( false )
+ {}
~InputStyle()
{};
+ /**
+ * @brief
+ *
+ * Does not copy the font-style, underline, shadow, emboss and outline property strings.
+ */
+ void Copy( const InputStyle& inputStyle )
+ {
+ isDefaultColor = inputStyle.isDefaultColor;
+ textColor = inputStyle.textColor;
+
+ isFamilyDefined = inputStyle.isFamilyDefined;
+ familyName = inputStyle.familyName;
+
+ isWeightDefined = inputStyle.isWeightDefined;
+ weight = inputStyle.weight;
+
+ isWidthDefined = inputStyle.isWidthDefined;
+ width = inputStyle.width;
+
+ isSlantDefined = inputStyle.isSlantDefined;
+ slant = inputStyle.slant;
+
+ isSizeDefined = inputStyle.isSizeDefined;
+ size = inputStyle.size;
+
+ isLineSpacingDefined = inputStyle.isLineSpacingDefined;
+ lineSpacing = inputStyle.lineSpacing;
+
+ isUnderlineDefined = inputStyle.isUnderlineDefined;
+ underlineProperties = inputStyle.underlineProperties;
+
+ isShadowDefined = inputStyle.isShadowDefined;
+ shadowProperties = inputStyle.shadowProperties;
+
+ isEmbossDefined = inputStyle.isEmbossDefined;
+ embossProperties = inputStyle.embossProperties;
+
+ isOutlineDefined = inputStyle.isOutlineDefined;
+ outlineProperties = inputStyle.outlineProperties;
+ }
+
+ /**
+ * @brief
+ *
+ * Does not compare the font-style, underline, shadow, emboss and outline property strings.
+ */
+ bool Equal( const InputStyle& inputStyle ) const
+ {
+ if( ( isDefaultColor != inputStyle.isDefaultColor ) ||
+ ( isFamilyDefined != inputStyle.isFamilyDefined ) ||
+ ( isWeightDefined != inputStyle.isWeightDefined ) ||
+ ( isWidthDefined != inputStyle.isWidthDefined ) ||
+ ( isSlantDefined != inputStyle.isSlantDefined ) ||
+ ( isSizeDefined != inputStyle.isSizeDefined ) ||
+ ( isLineSpacingDefined != inputStyle.isLineSpacingDefined ) ||
+ ( isUnderlineDefined != inputStyle.isUnderlineDefined ) ||
+ ( isShadowDefined != inputStyle.isShadowDefined ) ||
+ ( isEmbossDefined != inputStyle.isEmbossDefined ) ||
+ ( isOutlineDefined != inputStyle.isOutlineDefined ) ||
+ ( textColor != inputStyle.textColor ) ||
+ ( familyName != inputStyle.familyName ) ||
+ ( weight != inputStyle.weight ) ||
+ ( width != inputStyle.width ) ||
+ ( slant != inputStyle.slant ) ||
+ ( size != inputStyle.size ) ||
+ ( lineSpacing != inputStyle.lineSpacing ) ||
+ ( underlineProperties != inputStyle.underlineProperties ) ||
+ ( shadowProperties != inputStyle.shadowProperties ) ||
+ ( embossProperties != inputStyle.embossProperties ) ||
+ ( outlineProperties != inputStyle.outlineProperties ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ Mask GetInputStyleChangeMask( const InputStyle& inputStyle ) const
+ {
+ Mask mask = NONE;
+
+ if( textColor != inputStyle.textColor )
+ {
+ mask = static_cast<Mask>( mask | INPUT_COLOR );
+ }
+ if( familyName != inputStyle.familyName )
+ {
+ mask = static_cast<Mask>( mask | INPUT_FONT_FAMILY );
+ }
+ if( weight != inputStyle.weight )
+ {
+ mask = static_cast<Mask>( mask | INPUT_FONT_WEIGHT );
+ }
+ if( width != inputStyle.width )
+ {
+ mask = static_cast<Mask>( mask | INPUT_FONT_WIDTH );
+ }
+ if( slant != inputStyle.slant )
+ {
+ mask = static_cast<Mask>( mask | INPUT_FONT_SLANT );
+ }
+ if( size != inputStyle.size )
+ {
+ mask = static_cast<Mask>( mask | INPUT_POINT_SIZE );
+ }
+ if( lineSpacing != inputStyle.lineSpacing )
+ {
+ mask = static_cast<Mask>( mask | INPUT_LINE_SPACING );
+ }
+ if( underlineProperties != inputStyle.underlineProperties )
+ {
+ mask = static_cast<Mask>( mask | INPUT_UNDERLINE );
+ }
+ if( shadowProperties != inputStyle.shadowProperties )
+ {
+ mask = static_cast<Mask>( mask | INPUT_SHADOW );
+ }
+ if( embossProperties != inputStyle.embossProperties )
+ {
+ mask = static_cast<Mask>( mask | INPUT_EMBOSS );
+ }
+ if( outlineProperties != inputStyle.outlineProperties )
+ {
+ mask = static_cast<Mask>( mask | INPUT_OUTLINE );
+ }
+
+ return mask;
+ }
+
Vector4 textColor; ///< The text's color.
- std::string fontStyle; ///< The font's style string.
std::string familyName; ///< The font's family name.
FontWeight weight; ///< The font's weight.
FontWidth width; ///< The font's width.
float size; ///< The font's size.
float lineSpacing; ///< The line's spacing.
+
std::string underlineProperties; ///< The underline properties string.
std::string shadowProperties; ///< The shadow properties string.
std::string embossProperties; ///< The emboss properties string.
std::string outlineProperties; ///< The outline properties string.
- bool isDefaultColor : 1; ///< Whether the text's color is the default.
- bool familyDefined : 1; ///< Whether the font's family is defined.
- bool weightDefined : 1; ///< Whether the font's weight is defined.
- bool widthDefined : 1; ///< Whether the font's width is defined.
- bool slantDefined : 1; ///< Whether the font's slant is defined.
- bool sizeDefined : 1; ///< Whether the font's size is defined.
-
- bool lineSpacingDefined : 1; ///< Whether the line spacing is defined.
+ bool isDefaultColor : 1; ///< Whether the text's color is the default.
+ bool isFamilyDefined : 1; ///< Whether the font's family is defined.
+ bool isWeightDefined : 1; ///< Whether the font's weight is defined.
+ bool isWidthDefined : 1; ///< Whether the font's width is defined.
+ bool isSlantDefined : 1; ///< Whether the font's slant is defined.
+ bool isSizeDefined : 1; ///< Whether the font's size is defined.
+
+ bool isLineSpacingDefined : 1; ///< Whether the line spacing is defined.
+ bool isUnderlineDefined : 1; ///< Whether the underline parameters are defined.
+ bool isShadowDefined : 1; ///< Whether the shadow parameters are defined.
+ bool isEmbossDefined : 1; ///< Whether the emboss parameters are defined.
+ bool isOutlineDefined : 1; ///< Whether the outline parameters are defined.
};
} // namespace Text
/*
- * 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.
const FontDescriptionRun& fontDescriptionRun = *( fontDescriptionRunsBuffer + nameIndex );
style.familyName = std::string( fontDescriptionRun.familyName, fontDescriptionRun.familyLength );
- style.familyDefined = true;
+ style.isFamilyDefined = true;
}
// Set the font's weight if it's overriden.
const FontDescriptionRun& fontDescriptionRun = *( fontDescriptionRunsBuffer + weightIndex );
style.weight = fontDescriptionRun.weight;
- style.weightDefined = true;
+ style.isWeightDefined = true;
}
// Set the font's width if it's overriden.
const FontDescriptionRun& fontDescriptionRun = *( fontDescriptionRunsBuffer + widthIndex );
style.width = fontDescriptionRun.width;
- style.widthDefined = true;
+ style.isWidthDefined = true;
}
// Set the font's slant if it's overriden.
const FontDescriptionRun& fontDescriptionRun = *( fontDescriptionRunsBuffer + slantIndex );
style.slant = fontDescriptionRun.slant;
- style.slantDefined = true;
+ style.isSlantDefined = true;
}
// Set the font's size if it's overriden.
const FontDescriptionRun& fontDescriptionRun = *( fontDescriptionRunsBuffer + sizeIndex );
style.size = static_cast<float>( fontDescriptionRun.size ) / 64.f;
- style.sizeDefined = true;
+ style.isSizeDefined = true;
}
}
{
void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
- Vector<FontId>& fontIds,
- Vector<bool>& isDefaultFont,
const TextAbstraction::FontDescription& defaultFontDescription,
TextAbstraction::PointSize26Dot6 defaultPointSize,
- CharacterIndex startIndex,
- Length numberOfCharacters )
+ CharacterIndex characterIndex,
+ TextAbstraction::FontDescription& fontDescription,
+ TextAbstraction::PointSize26Dot6& fontPointSize,
+ bool& isDefaultFont )
{
- // Get the handle to the font client.
- TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ // Initialize with the default font's point size.
+ fontPointSize = defaultPointSize;
- // Pointer to the font id buffer.
- FontId* fontIdsBuffer = fontIds.Begin();
+ // Initialize with the style parameters of the default font's style.
+ fontDescription = defaultFontDescription;
- // Pointer to the 'is default' font buffer.
- bool* isDefaultFontBuffer = isDefaultFont.Begin();
+ // Initialize as a default font.
+ isDefaultFont = true;
- // Used to temporarily store the style per character.
- TextAbstraction::FontDescription fontDescription;
- TextAbstraction::PointSize26Dot6 fontSize;
+ Length runIndex = 0u;
Length familyIndex = 0u;
Length weightIndex = 0u;
Length slantIndex = 0u;
Length sizeIndex = 0u;
- // Traverse all the characters.
- const CharacterIndex lastCharacterPlusOne = startIndex + numberOfCharacters;
- for( CharacterIndex index = startIndex; index < lastCharacterPlusOne; ++index )
+ bool familyOverriden = false;
+ bool weightOverriden = false;
+ bool widthOverriden = false;
+ bool slantOverriden = false;
+ bool sizeOverriden = false;
+
+ // Traverse all the font descriptions.
+ const FontDescriptionRun* const fontDescriptionsBuffer = fontDescriptions.Begin();
+ for( Vector<FontDescriptionRun>::ConstIterator it = fontDescriptionsBuffer,
+ endIt = fontDescriptions.End();
+ it != endIt;
+ ++it, ++runIndex )
{
- bool& defaultFont = *(isDefaultFontBuffer + index - startIndex );
-
- Length runIndex = 0u;
-
- bool familyOverriden = false;
- bool weightOverriden = false;
- bool widthOverriden = false;
- bool slantOverriden = false;
- bool sizeOverriden = false;
-
- // Traverse all the font descriptions.
- const FontDescriptionRun* const fontDescriptionsBuffer = fontDescriptions.Begin();
- for( Vector<FontDescriptionRun>::ConstIterator it = fontDescriptionsBuffer,
- endIt = fontDescriptions.End();
- it != endIt;
- ++it, ++runIndex )
+ // Check whether the character's font is modified by the current font description.
+ const FontDescriptionRun& fontRun = *it;
+ if( ( characterIndex >= fontRun.characterRun.characterIndex ) &&
+ ( characterIndex < fontRun.characterRun.characterIndex + fontRun.characterRun.numberOfCharacters ) )
{
- // Check whether the character's font is modified by the current font description.
- const FontDescriptionRun& fontRun = *it;
- if( ( index >= fontRun.characterRun.characterIndex ) &&
- ( index < fontRun.characterRun.characterIndex + fontRun.characterRun.numberOfCharacters ) )
+ if( fontRun.familyDefined )
{
- if( fontRun.familyDefined )
- {
- defaultFont = false;
- familyOverriden = true;
- familyIndex = runIndex;
- }
- if( fontRun.weightDefined )
- {
- defaultFont = false;
- weightOverriden = true;
- weightIndex = runIndex;
- }
- if( fontRun.widthDefined )
- {
- defaultFont = false;
- widthOverriden = true;
- widthIndex = runIndex;
- }
- if( fontRun.slantDefined )
- {
- defaultFont = false;
- slantOverriden = true;
- slantIndex = runIndex;
- }
- if( fontRun.sizeDefined )
- {
- defaultFont = false;
- sizeOverriden = true;
- sizeIndex = runIndex;
- }
+ isDefaultFont = false;
+ familyOverriden = true;
+ familyIndex = runIndex;
}
- }
-
- // Get the font id if is not the default font.
- if( !defaultFont )
- {
- if( familyOverriden )
+ if( fontRun.weightDefined )
{
- const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + familyIndex );
- fontDescription.family = std::string( fontRun.familyName, fontRun.familyLength ); // TODO Could use move constructor when switch to c++11.
+ isDefaultFont = false;
+ weightOverriden = true;
+ weightIndex = runIndex;
}
- else
+ if( fontRun.widthDefined )
{
- fontDescription.family = defaultFontDescription.family;
+ isDefaultFont = false;
+ widthOverriden = true;
+ widthIndex = runIndex;
}
-
- if( weightOverriden )
+ if( fontRun.slantDefined )
{
- const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + weightIndex );
- fontDescription.weight = fontRun.weight;
+ isDefaultFont = false;
+ slantOverriden = true;
+ slantIndex = runIndex;
}
- else
+ if( fontRun.sizeDefined )
{
- fontDescription.weight = defaultFontDescription.weight;
+ isDefaultFont = false;
+ sizeOverriden = true;
+ sizeIndex = runIndex;
}
+ }
+ }
- if( widthOverriden )
- {
- const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + widthIndex );
- fontDescription.width = fontRun.width;
- }
- else
- {
- fontDescription.width = defaultFontDescription.width;
- }
+ // Get the font's description if is not the default font.
+ if( !isDefaultFont )
+ {
+ if( familyOverriden )
+ {
+ const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + familyIndex );
+ fontDescription.family = std::string( fontRun.familyName, fontRun.familyLength );
+ }
- if( slantOverriden )
- {
- const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + slantIndex );
- fontDescription.slant = fontRun.slant;
- }
- else
- {
- fontDescription.slant = defaultFontDescription.slant;
- }
+ if( weightOverriden )
+ {
+ const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + weightIndex );
+ fontDescription.weight = fontRun.weight;
+ }
- if( sizeOverriden )
- {
- const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + sizeIndex );
- fontSize = fontRun.size;
- }
- else
- {
- fontSize = defaultPointSize;
- }
+ if( widthOverriden )
+ {
+ const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + widthIndex );
+ fontDescription.width = fontRun.width;
+ }
- *( fontIdsBuffer + index - startIndex ) = fontClient.GetFontId( fontDescription, fontSize );
+ if( slantOverriden )
+ {
+ const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + slantIndex );
+ fontDescription.slant = fontRun.slant;
+ }
+
+ if( sizeOverriden )
+ {
+ const FontDescriptionRun& fontRun = *( fontDescriptionsBuffer + sizeIndex );
+ fontPointSize = fontRun.size;
}
}
}
{
/**
- * @brief Merges the font descriptions to retrieve the font Id for each character.
+ * @brief Merges font's descriptions to retrieve the combined font's description for a given character.
*
- * @param[in] fontDescriptions The font descriptions.
- * @param[out] fontIds The font id for each character.
+ * @param[in] fontDescriptions The font's descriptions for the whole text.
+ * @param[in] defaultFontDescription The default font's description.
+ * @param[in] defaultPointSize The default font's point size.
+ * @param[in] characterIndex Index to the character to retrieve its font's description.
+ * @param[out] fontDescription The font's description for the character.
+ * @param[out] fontPointSize The font's point size for the character.
* @param[out] isDefaultFont Whether the font is a default one.
- * @param[in] defaultFontDescription The default font description.
- * @param[in] defaultPointSize The default font size.
- * @param[in] startIndex The character from where the fonts are merged.
- * @param[in] numberOfCharacters The number of characters to set the font.
*/
void MergeFontDescriptions( const Vector<FontDescriptionRun>& fontDescriptions,
- Vector<FontId>& fontIds,
- Vector<bool>& isDefaultFont,
const TextAbstraction::FontDescription& defaultFontDescription,
TextAbstraction::PointSize26Dot6 defaultPointSize,
- CharacterIndex startIndex,
- Length numberOfCharacters );
+ CharacterIndex characterIndex,
+ TextAbstraction::FontDescription& fontDescription,
+ TextAbstraction::PointSize26Dot6& fontPointSize,
+ bool& isDefaultFont );
/**
* @brief Retrieves the script Id from the script run for a given character's @p index.
return false;
}
-FontId DefaultFonts::FindFont( TextAbstraction::FontClient& fontClient, PointSize26Dot6 size ) const
+FontId DefaultFonts::FindFont( TextAbstraction::FontClient& fontClient,
+ const TextAbstraction::FontDescription& description,
+ PointSize26Dot6 size ) const
{
- for( Vector<FontId>::ConstIterator it = mFonts.Begin(),
- endIt = mFonts.End();
+ for( std::vector<CacheItem>::const_iterator it = mFonts.begin(),
+ endIt = mFonts.end();
it != endIt;
++it )
{
- const FontId fontId = *it;
- if( size == fontClient.GetPointSize( fontId ) )
+ const CacheItem& item = *it;
+
+ if( ( ( TextAbstraction::FontWeight::NONE == description.weight ) || ( description.weight == item.description.weight ) ) &&
+ ( ( TextAbstraction::FontWidth::NONE == description.width ) || ( description.width == item.description.width ) ) &&
+ ( ( TextAbstraction::FontSlant::NONE == description.slant ) || ( description.slant == item.description.slant ) ) &&
+ ( size == fontClient.GetPointSize( item.fontId ) ) &&
+ ( description.family.empty() || ( description.family == item.description.family ) ) )
{
- return fontId;
+ return item.fontId;
}
}
return 0u;
}
+void DefaultFonts::Cache( const TextAbstraction::FontDescription& description, FontId fontId )
+{
+ CacheItem item;
+ item.description = description;
+ item.fontId = fontId;
+ mFonts.push_back( item );
+}
+
MultilanguageSupport::MultilanguageSupport()
: mDefaultFontPerScriptCache(),
mValidFontsPerScriptCache()
void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
const Vector<ScriptRun>& scripts,
const Vector<FontDescriptionRun>& fontDescriptions,
- FontId defaultFontId,
+ const TextAbstraction::FontDescription& defaultFontDescription,
+ TextAbstraction::PointSize26Dot6 defaultFontPointSize,
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<FontRun>& fonts )
// Get the font client.
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- // Get the default font description and default size.
- TextAbstraction::FontDescription defaultFontDescription;
- TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
- if( defaultFontId > 0u )
- {
- fontClient.GetDescription( defaultFontId, defaultFontDescription );
- defaultPointSize = fontClient.GetPointSize( defaultFontId );
- }
-
- // Merge font descriptions
- Vector<FontId> fontIds;
- fontIds.Resize( numberOfCharacters, defaultFontId );
- Vector<bool> isDefaultFont;
- isDefaultFont.Resize( numberOfCharacters, true );
- MergeFontDescriptions( fontDescriptions,
- fontIds,
- isDefaultFont,
- defaultFontDescription,
- defaultPointSize,
- startIndex,
- numberOfCharacters );
-
const Character* const textBuffer = text.Begin();
- const FontId* const fontIdsBuffer = fontIds.Begin();
- const bool* const isDefaultFontBuffer = isDefaultFont.Begin();
+
+ // Iterators of the script runs.
Vector<ScriptRun>::ConstIterator scriptRunIt = scripts.Begin();
Vector<ScriptRun>::ConstIterator scriptRunEndIt = scripts.End();
bool isNewParagraphCharacter = false;
- PointSize26Dot6 currentPointSize = defaultPointSize;
FontId currentFontId = 0u;
FontId previousFontId = 0u;
bool isPreviousEmojiScript = false;
// Get the current character.
const Character character = *( textBuffer + index );
- // Get the font for the current character.
- FontId fontId = *( fontIdsBuffer + index - startIndex );
+ TextAbstraction::FontDescription currentFontDescription;
+ TextAbstraction::PointSize26Dot6 currentFontPointSize = defaultFontPointSize;
+ bool isDefaultFont = true;
+ MergeFontDescriptions( fontDescriptions,
+ defaultFontDescription,
+ defaultFontPointSize,
+ index,
+ currentFontDescription,
+ currentFontPointSize,
+ isDefaultFont );
- // Whether the font being validated for the current character is a default one not set by the user.
- const bool isDefault = *( isDefaultFontBuffer + index - startIndex );
+ // Get the font for the current character.
+ FontId fontId = fontClient.GetFontId( currentFontDescription, currentFontPointSize );
+ currentFontId = fontId;
// Get the script for the current character.
const Script script = GetScript( index,
scriptRunIt,
scriptRunEndIt );
- // Get the current point size.
- if( currentFontId != fontId )
- {
- currentPointSize = fontClient.GetPointSize( fontId );
- currentFontId = fontId;
- }
-
#ifdef DEBUG_ENABLED
{
Dali::TextAbstraction::FontDescription description;
FontId cachedDefaultFontId = 0u;
if( NULL != defaultFonts )
{
- cachedDefaultFontId = defaultFonts->FindFont( fontClient, currentPointSize );
+ cachedDefaultFontId = defaultFonts->FindFont( fontClient,
+ currentFontDescription,
+ currentFontPointSize );
}
// Whether the cached default font is valid.
if( isCommonScript )
{
if( isValidCachedDefaultFont &&
- ( isDefault || ( currentFontId == previousFontId ) ) &&
+ ( isDefaultFont || ( currentFontId == previousFontId ) ) &&
!isEmojiScript )
{
// At this point the character common for all scripts has no font assigned.
const bool preferColor = ( TextAbstraction::EMOJI == script );
// Find a fallback-font.
- fontId = fontClient.FindFallbackFont( currentFontId, character, currentPointSize, preferColor );
+ fontId = fontClient.FindFallbackFont( character,
+ currentFontDescription,
+ currentFontPointSize,
+ preferColor );
if( 0u == fontId )
{
defaultFontsPerScript = *( defaultFontPerScriptCacheBuffer + TextAbstraction::LATIN );
if( NULL != defaultFontsPerScript )
{
- fontId = defaultFontsPerScript->FindFont( fontClient, currentPointSize );
+ fontId = defaultFontsPerScript->FindFont( fontClient,
+ currentFontDescription,
+ currentFontPointSize );
}
}
if( 0u == fontId )
{
- fontId = fontClient.FindDefaultFont( UTF32_A, currentPointSize );
+ fontId = fontClient.FindDefaultFont( UTF32_A, currentFontPointSize );
}
// Cache the font.
*( defaultFontPerScriptCacheBuffer + script ) = defaultFontsPerScript;
}
}
- defaultFontsPerScript->mFonts.PushBack( fontId );
+ defaultFontsPerScript->Cache( currentFontDescription, fontId );
}
} // !isValidFont (3)
} // !isValidFont (2)
*/
struct DefaultFonts
{
+ struct CacheItem
+ {
+ TextAbstraction::FontDescription description;
+ FontId fontId ;
+ };
+
/**
* Default constructor.
*/
* @brief Finds a default font for the given @p size.
*
* @param[in] fontClient The font client.
+ * @param[in] description The font's description.
* @param[in] size The given size.
*
* @return The font id of a default font for the given @p size. If there isn't any font cached it returns 0.
*/
- FontId FindFont( TextAbstraction::FontClient& fontClient, PointSize26Dot6 size ) const;
+ FontId FindFont( TextAbstraction::FontClient& fontClient,
+ const TextAbstraction::FontDescription& description,
+ PointSize26Dot6 size ) const;
+
+ void Cache( const TextAbstraction::FontDescription& description, FontId fontId );
- Vector<FontId> mFonts;
+ std::vector<CacheItem> mFonts;
};
/**
void ValidateFonts( const Vector<Character>& text,
const Vector<ScriptRun>& scripts,
const Vector<FontDescriptionRun>& fontDescriptions,
- FontId defaultFontId,
+ const TextAbstraction::FontDescription& defaultFontDescription,
+ TextAbstraction::PointSize26Dot6 defaultFontPointSize,
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<FontRun>& fonts );
void MultilanguageSupport::ValidateFonts( const Vector<Character>& text,
const Vector<ScriptRun>& scripts,
const Vector<FontDescriptionRun>& fontDescriptions,
- FontId defaultFontId,
+ const TextAbstraction::FontDescription& defaultFontDescription,
+ TextAbstraction::PointSize26Dot6 defaultFontPointSize,
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<FontRun>& fonts )
GetImplementation( *this ).ValidateFonts( text,
scripts,
fontDescriptions,
- defaultFontId,
+ defaultFontDescription,
+ defaultFontPointSize,
startIndex,
numberOfCharacters,
fonts );
*
* @param[in] text Vector of UTF-32 characters.
* @param[in] scripts Vector containing the script runs for the whole text.
- * @param[in] fontDescriptions The fonts set by the application developers.
- * @param[in] defaultFontId The default font's id.
+ * @param[in] fontDescriptions The fonts set through the mark-up string or the input style set through the property system.
+ * @param[in] defaultFontDescription The default font's description set through the property system.
+ * @param[in] defaultFontPointSize The default font's point size set through the property system.
* @param[in] startIndex The character from where the font info is set.
* @param[in] numberOfCharacters The number of characters to set the font.
* @param[out] fonts The validated fonts.
void ValidateFonts( const Vector<Character>& text,
const Vector<ScriptRun>& scripts,
const Vector<FontDescriptionRun>& fontDescriptions,
- FontId defaultFontId,
+ const TextAbstraction::FontDescription& defaultFontDescription,
+ TextAbstraction::PointSize26Dot6 defaultFontPointSize,
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<FontRun>& fonts );
#define __DALI_TOOLKIT_TEXT_CONTROL_INTERFACE_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.
*
*/
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/input-style.h>
+
namespace Dali
{
* @brief Called when the number of characters to be inserted exceeds the maximum limit
*/
virtual void MaxLengthReached() = 0;
+
+ /**
+ * @brief Called to signal that input style has been changed.
+ *
+ * @param[in] inputStyleMask Mask with the bits of the input style that has changed.
+ */
+ virtual void InputStyleChanged( InputStyle::Mask inputStyleMask ) = 0;
};
} // namespace Text
/*
- * 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.
mPlaceholderTextInactive(),
mPlaceholderTextColor( 0.8f, 0.8f, 0.8f, 0.8f ),
mEventQueue(),
+ mInputStyleChangedQueue(),
mState( INACTIVE ),
mPrimaryCursorPosition( 0u ),
mLeftSelectionPosition( 0u ),
if( mEventData->mUpdateInputStyle )
{
+ // Keep a copy of the current input style.
+ InputStyle currentInputStyle;
+ currentInputStyle.Copy( mEventData->mInputStyle );
+
// Set the default style first.
RetrieveDefaultInputStyle( mEventData->mInputStyle );
// Retrieve the style from the style runs stored in the logical model.
mLogicalModel->RetrieveStyle( styleIndex, mEventData->mInputStyle );
+ // Compare if the input style has changed.
+ const bool hasInputStyleChanged = !currentInputStyle.Equal( mEventData->mInputStyle );
+
+ if( hasInputStyleChanged )
+ {
+ const InputStyle::Mask styleChangedMask = currentInputStyle.GetInputStyleChangeMask( mEventData->mInputStyle );
+ // Queue the input style changed signal.
+ mEventData->mInputStyleChangedQueue.PushBack( styleChangedMask );
+ }
+
mEventData->mUpdateInputStyle = false;
}
}
}
+void Controller::Impl::NotifyImfMultiLineStatus()
+{
+ if ( mEventData )
+ {
+ LayoutEngine::Layout layout = mLayoutEngine.GetLayout();
+ mEventData->mImfManager.NotifyTextInputMultiLine( layout == LayoutEngine::MULTI_LINE_BOX );
+ }
+}
+
CharacterIndex Controller::Impl::GetLogicalCursorPosition() const
{
CharacterIndex cursorPosition = 0u;
// Validate the fonts set through the mark-up string.
Vector<FontDescriptionRun>& fontDescriptionRuns = mLogicalModel->mFontDescriptionRuns;
- // Get the default font id.
- const FontId defaultFontId = ( NULL == mFontDefaults ) ? 0u : mFontDefaults->GetFontId( mFontClient );
+ // Get the default font's description.
+ TextAbstraction::FontDescription defaultFontDescription;
+ TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE;
+ if( NULL != mFontDefaults )
+ {
+ defaultFontDescription = mFontDefaults->mFontDescription;
+ defaultPointSize = mFontDefaults->mDefaultPointSize * 64u;
+ }
// Validates the fonts. If there is a character with no assigned font it sets a default one.
// After this call, fonts are validated.
multilanguageSupport.ValidateFonts( utf32Characters,
scripts,
fontDescriptionRuns,
- defaultFontId,
+ defaultFontDescription,
+ defaultPointSize,
startIndex,
requestedNumberOfCharacters,
validFonts );
inputStyle.slant = TextAbstraction::FontSlant::NORMAL;
inputStyle.size = 0.f;
- inputStyle.familyDefined = false;
- inputStyle.weightDefined = false;
- inputStyle.widthDefined = false;
- inputStyle.slantDefined = false;
- inputStyle.sizeDefined = false;
+ inputStyle.lineSpacing = 0.f;
+
+ inputStyle.underlineProperties.clear();
+ inputStyle.shadowProperties.clear();
+ inputStyle.embossProperties.clear();
+ inputStyle.outlineProperties.clear();
+
+ inputStyle.isFamilyDefined = false;
+ inputStyle.isWeightDefined = false;
+ inputStyle.isWidthDefined = false;
+ inputStyle.isSlantDefined = false;
+ inputStyle.isSizeDefined = false;
+
+ inputStyle.isLineSpacingDefined = false;
+
+ inputStyle.isUnderlineDefined = false;
+ inputStyle.isShadowDefined = false;
+ inputStyle.isEmbossDefined = false;
+ inputStyle.isOutlineDefined = false;
// Sets the default font's family name, weight, width, slant and size.
if( mFontDefaults )
if( mFontDefaults->familyDefined )
{
inputStyle.familyName = mFontDefaults->mFontDescription.family;
- inputStyle.familyDefined = true;
+ inputStyle.isFamilyDefined = true;
}
if( mFontDefaults->weightDefined )
{
inputStyle.weight = mFontDefaults->mFontDescription.weight;
- inputStyle.weightDefined = true;
+ inputStyle.isWeightDefined = true;
}
if( mFontDefaults->widthDefined )
{
inputStyle.width = mFontDefaults->mFontDescription.width;
- inputStyle.widthDefined = true;
+ inputStyle.isWidthDefined = true;
}
if( mFontDefaults->slantDefined )
{
inputStyle.slant = mFontDefaults->mFontDescription.slant;
- inputStyle.slantDefined = true;
+ inputStyle.isSlantDefined = true;
}
if( mFontDefaults->sizeDefined )
{
inputStyle.size = mFontDefaults->mDefaultPointSize;
- inputStyle.sizeDefined = true;
+ inputStyle.isSizeDefined = true;
}
}
}
if( deleteAfterRetrieval ) // Only delete text if copied successfully
{
+ // Keep a copy of the current input style.
+ InputStyle currentInputStyle;
+ currentInputStyle.Copy( mEventData->mInputStyle );
+
// Set as input style the style of the first deleted character.
mLogicalModel->RetrieveStyle( startOfSelectedText, mEventData->mInputStyle );
+ // Compare if the input style has changed.
+ const bool hasInputStyleChanged = !currentInputStyle.Equal( mEventData->mInputStyle );
+
+ if( hasInputStyleChanged )
+ {
+ const InputStyle::Mask styleChangedMask = currentInputStyle.GetInputStyleChangeMask( mEventData->mInputStyle );
+ // Queue the input style changed signal.
+ mEventData->mInputStyleChangedQueue.PushBack( styleChangedMask );
+ }
+
mLogicalModel->UpdateTextStyleRuns( startOfSelectedText, -static_cast<int>( lengthOfSelectedText ) );
// Mark the paragraphs to be updated.
ChangeState( EventData::EDITING );
}
-void Controller::Impl::GetTextFromClipboard( unsigned int itemIndex, std::string& retrievedString )
+void Controller::Impl::RequestGetTextFromClipboard()
{
if ( mClipboard )
{
- retrievedString = mClipboard.GetItem( itemIndex );
+ mClipboard.RequestItem();
}
}
mEventData->mDecorator->SetHighlightActive( false );
mEventData->mDecorator->SetPopupActive( false );
mEventData->mDecoratorUpdated = true;
- HideClipboard();
break;
}
case EventData::INTERRUPTED:
mEventData->mDecorator->SetHighlightActive( false );
mEventData->mDecorator->SetPopupActive( false );
mEventData->mDecoratorUpdated = true;
- HideClipboard();
break;
}
case EventData::SELECTING:
mEventData->mDecorator->SetPopupActive( false );
}
mEventData->mDecoratorUpdated = true;
- HideClipboard();
break;
}
case EventData::EDITING_WITH_POPUP:
SetPopupButtons();
mEventData->mDecorator->SetPopupActive( true );
}
- HideClipboard();
mEventData->mDecoratorUpdated = true;
break;
}
mEventData->mDecorator->SetPopupActive( false );
}
mEventData->mDecoratorUpdated = true;
- HideClipboard();
break;
}
case EventData::SELECTION_HANDLE_PANNING:
SetPopupButtons();
mEventData->mDecorator->SetPopupActive( true );
}
- HideClipboard();
mEventData->mDecoratorUpdated = true;
break;
}
#define __DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_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.
*/
std::vector<Event> mEventQueue; ///< The queue of touch events etc.
+ Vector<InputStyle::Mask> mInputStyleChangedQueue; ///< Queue of changes in the input style. Used to emit the signal in the iddle callback.
+
InputStyle mInputStyle; ///< The style to be set to the new inputed text.
State mPreviousState; ///< Stores the current state before it's updated with the new one.
{
FontDefaults()
: mFontDescription(),
- mFontStyle(),
mDefaultPointSize( 0.f ),
mFontId( 0u ),
familyDefined( false ),
}
TextAbstraction::FontDescription mFontDescription; ///< The default font's description.
- std::string mFontStyle; ///< The font's style string set through the property system.
float mDefaultPointSize; ///< The default font's point size.
FontId mFontId; ///< The font's id of the default font.
bool familyDefined:1; ///< Whether the default font's family name is defined.
*/
void NotifyImfManager();
+ /**
+ * @brief Helper to notify IMF manager with multi line status.
+ */
+ void NotifyImfMultiLineStatus();
+
/**
* @brief Retrieve the current cursor position.
*
return !result; // If NumberOfItems greater than 0, return false
}
+ bool IsClipboardVisible()
+ {
+ bool result( mClipboard && mClipboard.IsVisible() );
+ return result;
+ }
+
/**
* @brief Calculates the start character index of the first paragraph to be updated and
* the end character index of the last paragraph to be updated.
void SendSelectionToClipboard( bool deleteAfterSending );
- void GetTextFromClipboard( unsigned int itemIndex, std::string& retrievedString );
+ void RequestGetTextFromClipboard();
void RepositionSelectionHandles();
void RepositionSelectionHandles( float visualX, float visualY );
/*
- * 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.
return fontDescriptionRun;
}
+// public : Constructor.
+
ControllerPtr Controller::New( ControlInterface& controlInterface )
{
return ControllerPtr( new Controller( controlInterface ) );
}
+// public : Configure the text controller.
+
void Controller::EnableTextInput( DecoratorPtr decorator )
{
if( NULL == mImpl->mEventData )
return false;
}
+void Controller::SetMaximumNumberOfCharacters( Length maxCharacters )
+{
+ mImpl->mMaximumNumberOfCharacters = maxCharacters;
+}
+
+int Controller::GetMaximumNumberOfCharacters()
+{
+ return mImpl->mMaximumNumberOfCharacters;
+}
+
+void Controller::SetEnableCursorBlink( bool enable )
+{
+ DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "TextInput disabled" );
+
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mCursorBlinkEnabled = enable;
+
+ if( !enable &&
+ mImpl->mEventData->mDecorator )
+ {
+ mImpl->mEventData->mDecorator->StopCursorBlink();
+ }
+ }
+}
+
+bool Controller::GetEnableCursorBlink() const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mCursorBlinkEnabled;
+ }
+
+ return false;
+}
+
+void Controller::SetMultiLineEnabled( bool enable )
+{
+ const LayoutEngine::Layout layout = enable ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
+
+ if( layout != mImpl->mLayoutEngine.GetLayout() )
+ {
+ // Set the layout type.
+ mImpl->mLayoutEngine.SetLayout( layout );
+
+ // Set the flags to redo the layout operations
+ const OperationsMask layoutOperations = static_cast<OperationsMask>( LAYOUT |
+ UPDATE_LAYOUT_SIZE |
+ ALIGN |
+ REORDER );
+
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | layoutOperations );
+
+ mImpl->RequestRelayout();
+ }
+}
+
+bool Controller::IsMultiLineEnabled() const
+{
+ return LayoutEngine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
+}
+
+void Controller::SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment )
+{
+ if( alignment != mImpl->mLayoutEngine.GetHorizontalAlignment() )
+ {
+ // Set the alignment.
+ mImpl->mLayoutEngine.SetHorizontalAlignment( alignment );
+
+ // Set the flag to redo the alignment operation.
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
+
+ mImpl->RequestRelayout();
+ }
+}
+
+LayoutEngine::HorizontalAlignment Controller::GetHorizontalAlignment() const
+{
+ return mImpl->mLayoutEngine.GetHorizontalAlignment();
+}
+
+void Controller::SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment )
+{
+ if( alignment != mImpl->mLayoutEngine.GetVerticalAlignment() )
+ {
+ // Set the alignment.
+ mImpl->mLayoutEngine.SetVerticalAlignment( alignment );
+
+ mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
+
+ mImpl->RequestRelayout();
+ }
+}
+
+LayoutEngine::VerticalAlignment Controller::GetVerticalAlignment() const
+{
+ return mImpl->mLayoutEngine.GetVerticalAlignment();
+}
+
+// public : Update
+
void Controller::SetText( const std::string& text )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
}
}
-void Controller::SetMaximumNumberOfCharacters( Length maxCharacters )
+void Controller::UpdateAfterFontChange( const std::string& newDefaultFont )
{
- mImpl->mMaximumNumberOfCharacters = maxCharacters;
-}
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::UpdateAfterFontChange\n");
-int Controller::GetMaximumNumberOfCharacters()
-{
- return mImpl->mMaximumNumberOfCharacters;
+ if( !mImpl->mFontDefaults->familyDefined ) // If user defined font then should not update when system font changes
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::UpdateAfterFontChange newDefaultFont(%s)\n", newDefaultFont.c_str() );
+ mImpl->mFontDefaults->mFontDescription.family = newDefaultFont;
+
+ ClearFontData();
+
+ mImpl->RequestRelayout();
+ }
}
+// public : Default style & Input style
+
void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily )
{
if( NULL == mImpl->mFontDefaults )
mImpl->mFontDefaults->mFontDescription.family = defaultFontFamily;
DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetDefaultFontFamily %s\n", defaultFontFamily.c_str());
- mImpl->mFontDefaults->familyDefined = true;
+ mImpl->mFontDefaults->familyDefined = !defaultFontFamily.empty();
// Clear the font-specific data
ClearFontData();
return EMPTY_STRING;
}
-void Controller::SetDefaultFontStyle( const std::string& style )
-{
- if( NULL == mImpl->mFontDefaults )
- {
- mImpl->mFontDefaults = new FontDefaults();
- }
-
- mImpl->mFontDefaults->mFontStyle = style;
-}
-
-const std::string& Controller::GetDefaultFontStyle() const
-{
- if( NULL != mImpl->mFontDefaults )
- {
- return mImpl->mFontDefaults->mFontStyle;
- }
-
- return EMPTY_STRING;
-}
-
void Controller::SetDefaultFontWeight( FontWeight weight )
{
if( NULL == mImpl->mFontDefaults )
mImpl->RequestRelayout();
}
+bool Controller::IsDefaultFontWeightDefined() const
+{
+ return mImpl->mFontDefaults->weightDefined;
+}
+
FontWeight Controller::GetDefaultFontWeight() const
{
if( NULL != mImpl->mFontDefaults )
mImpl->RequestRelayout();
}
+bool Controller::IsDefaultFontWidthDefined() const
+{
+ return mImpl->mFontDefaults->widthDefined;
+}
+
FontWidth Controller::GetDefaultFontWidth() const
{
if( NULL != mImpl->mFontDefaults )
mImpl->RequestRelayout();
}
+bool Controller::IsDefaultFontSlantDefined() const
+{
+ return mImpl->mFontDefaults->slantDefined;
+}
+
FontSlant Controller::GetDefaultFontSlant() const
{
if( NULL != mImpl->mFontDefaults )
return 0.0f;
}
-void Controller::UpdateAfterFontChange( const std::string& newDefaultFont )
-{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::UpdateAfterFontChange\n");
-
- if( !mImpl->mFontDefaults->familyDefined ) // If user defined font then should not update when system font changes
- {
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::UpdateAfterFontChange newDefaultFont(%s)\n", newDefaultFont.c_str() );
- mImpl->mFontDefaults->mFontDescription.family = newDefaultFont;
-
- ClearFontData();
-
- mImpl->RequestRelayout();
- }
-}
-
void Controller::SetTextColor( const Vector4& textColor )
{
mImpl->mTextColor = textColor;
return mImpl->mTextColor;
}
-bool Controller::RemoveText( int cursorOffset,
- int numberOfCharacters,
- UpdateInputStyleType type )
-{
- bool removed = false;
-
- if( NULL == mImpl->mEventData )
- {
- return removed;
- }
-
- DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfCharacters %d\n",
- this, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfCharacters );
-
- if( !mImpl->IsShowingPlaceholderText() )
- {
- // Delete at current cursor position
- Vector<Character>& currentText = mImpl->mLogicalModel->mText;
- CharacterIndex& oldCursorIndex = mImpl->mEventData->mPrimaryCursorPosition;
-
- CharacterIndex cursorIndex = oldCursorIndex;
-
- // Validate the cursor position & number of characters
- if( static_cast< CharacterIndex >( std::abs( cursorOffset ) ) <= cursorIndex )
- {
- cursorIndex = oldCursorIndex + cursorOffset;
- }
-
- if( ( cursorIndex + numberOfCharacters ) > currentText.Count() )
- {
- numberOfCharacters = currentText.Count() - cursorIndex;
- }
-
- if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters )
- {
- // Mark the paragraphs to be updated.
- 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.
-
- if( UPDATE_INPUT_STYLE == type )
- {
- // Set first the default input style.
- mImpl->RetrieveDefaultInputStyle( mImpl->mEventData->mInputStyle );
-
- // Update the input style.
- mImpl->mLogicalModel->RetrieveStyle( cursorIndex, mImpl->mEventData->mInputStyle );
- }
-
- // Updates the text style runs by removing characters. Runs with no characters are removed.
- mImpl->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
-
- // Remove the characters.
- Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
- Vector<Character>::Iterator last = first + numberOfCharacters;
-
- currentText.Erase( first, last );
-
- // Cursor position retreat
- oldCursorIndex = cursorIndex;
-
- mImpl->mEventData->mScrollAfterDelete = true;
-
- DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p removed %d\n", this, numberOfCharacters );
- removed = true;
- }
- }
-
- return removed;
-}
-
void Controller::SetPlaceholderTextColor( const Vector4& textColor )
{
if( NULL != mImpl->mEventData )
if( NULL != mImpl->mEventData )
{
mImpl->mEventData->mInputStyle.familyName = fontFamily;
- mImpl->mEventData->mInputStyle.familyDefined = true;
+ mImpl->mEventData->mInputStyle.isFamilyDefined = true;
if( EventData::SELECTING == mImpl->mEventData->mState )
{
return GetDefaultFontFamily();
}
-void Controller::SetInputFontStyle( const std::string& fontStyle )
-{
- if( NULL != mImpl->mEventData )
- {
- mImpl->mEventData->mInputStyle.fontStyle = fontStyle;
- }
-}
-
-const std::string& Controller::GetInputFontStyle() const
-{
- if( NULL != mImpl->mEventData )
- {
- return mImpl->mEventData->mInputStyle.fontStyle;
- }
-
- // Return the default font's style if there is no EventData.
- return GetDefaultFontStyle();
-}
-
void Controller::SetInputFontWeight( FontWeight weight )
{
if( NULL != mImpl->mEventData )
{
mImpl->mEventData->mInputStyle.weight = weight;
- mImpl->mEventData->mInputStyle.weightDefined = true;
+ mImpl->mEventData->mInputStyle.isWeightDefined = true;
if( EventData::SELECTING == mImpl->mEventData->mState )
{
}
}
+bool Controller::IsInputFontWeightDefined() const
+{
+ bool defined = false;
+
+ if( NULL != mImpl->mEventData )
+ {
+ defined = mImpl->mEventData->mInputStyle.isWeightDefined;
+ }
+
+ return defined;
+}
+
FontWeight Controller::GetInputFontWeight() const
{
if( NULL != mImpl->mEventData )
if( NULL != mImpl->mEventData )
{
mImpl->mEventData->mInputStyle.width = width;
- mImpl->mEventData->mInputStyle.widthDefined = true;
+ mImpl->mEventData->mInputStyle.isWidthDefined = true;
if( EventData::SELECTING == mImpl->mEventData->mState )
{
}
}
-FontWidth Controller::GetInputFontWidth() const
+bool Controller::IsInputFontWidthDefined() const
{
+ bool defined = false;
+
if( NULL != mImpl->mEventData )
{
- return mImpl->mEventData->mInputStyle.width;
+ defined = mImpl->mEventData->mInputStyle.isWidthDefined;
+ }
+
+ return defined;
+}
+
+FontWidth Controller::GetInputFontWidth() const
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.width;
}
return GetDefaultFontWidth();
if( NULL != mImpl->mEventData )
{
mImpl->mEventData->mInputStyle.slant = slant;
- mImpl->mEventData->mInputStyle.slantDefined = true;
+ mImpl->mEventData->mInputStyle.isSlantDefined = true;
if( EventData::SELECTING == mImpl->mEventData->mState )
{
}
}
+bool Controller::IsInputFontSlantDefined() const
+{
+ bool defined = false;
+
+ if( NULL != mImpl->mEventData )
+ {
+ defined = mImpl->mEventData->mInputStyle.isSlantDefined;
+ }
+
+ return defined;
+}
+
FontSlant Controller::GetInputFontSlant() const
{
if( NULL != mImpl->mEventData )
if( NULL != mImpl->mEventData )
{
mImpl->mEventData->mInputStyle.size = size;
+ mImpl->mEventData->mInputStyle.isSizeDefined = true;
if( EventData::SELECTING == mImpl->mEventData->mState )
{
if( NULL != mImpl->mEventData )
{
mImpl->mEventData->mInputStyle.lineSpacing = lineSpacing;
+ mImpl->mEventData->mInputStyle.isLineSpacingDefined = true;
}
}
return GetDefaultOutlineProperties();
}
-void Controller::SetEnableCursorBlink( bool enable )
-{
- DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "TextInput disabled" );
-
- if( NULL != mImpl->mEventData )
- {
- mImpl->mEventData->mCursorBlinkEnabled = enable;
+// public : Queries & retrieves.
- if( !enable &&
- mImpl->mEventData->mDecorator )
- {
- mImpl->mEventData->mDecorator->StopCursorBlink();
- }
- }
+LayoutEngine& Controller::GetLayoutEngine()
+{
+ return mImpl->mLayoutEngine;
}
-bool Controller::GetEnableCursorBlink() const
+View& Controller::GetView()
{
- if( NULL != mImpl->mEventData )
- {
- return mImpl->mEventData->mCursorBlinkEnabled;
- }
-
- return false;
+ return mImpl->mView;
}
const Vector2& Controller::GetScrollPosition() const
return layoutSize.height;
}
+// public : Relayout.
+
Controller::UpdateTextType Controller::Relayout( const Size& size )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::Relayout %p size %f,%f, autoScroll[%s]\n", this, size.width, size.height, (mImpl->mAutoScrollEnabled)?"true":"false" );
return updateTextType;
}
-void Controller::ProcessModifyEvents()
+// public : Input style change signals.
+
+bool Controller::IsInputStyleChangedSignalsQueueEmpty()
{
- Vector<ModifyEvent>& events = mImpl->mModifyEvents;
+ return ( NULL == mImpl->mEventData ) || ( 0u == mImpl->mEventData->mInputStyleChangedQueue.Count() );
+}
- if( 0u == events.Count() )
+void Controller::ProcessInputStyleChangedSignals()
+{
+ if( NULL == mImpl->mEventData )
{
// Nothing to do.
return;
}
- for( Vector<ModifyEvent>::ConstIterator it = events.Begin(),
- endIt = events.End();
+ for( Vector<InputStyle::Mask>::ConstIterator it = mImpl->mEventData->mInputStyleChangedQueue.Begin(),
+ endIt = mImpl->mEventData->mInputStyleChangedQueue.End();
it != endIt;
++it )
{
- const ModifyEvent& event = *it;
-
- if( ModifyEvent::TEXT_REPLACED == event.type )
- {
- // A (single) replace event should come first, otherwise we wasted time processing NOOP events
- DALI_ASSERT_DEBUG( it == events.Begin() && "Unexpected TEXT_REPLACED event" );
-
- TextReplacedEvent();
- }
- else if( ModifyEvent::TEXT_INSERTED == event.type )
- {
- TextInsertedEvent();
- }
- else if( ModifyEvent::TEXT_DELETED == event.type )
- {
- // Placeholder-text cannot be deleted
- if( !mImpl->IsShowingPlaceholderText() )
- {
- TextDeletedEvent();
- }
- }
- }
+ const InputStyle::Mask mask = *it;
- if( NULL != mImpl->mEventData )
- {
- // When the text is being modified, delay cursor blinking
- mImpl->mEventData->mDecorator->DelayCursorBlink();
+ // Emit the input style changed signal.
+ mImpl->mControlInterface.InputStyleChanged( mask );
}
- // Discard temporary text
- events.Clear();
+ mImpl->mEventData->mInputStyleChangedQueue.Clear();
}
-void Controller::ResetText()
-{
- // Reset buffers.
- mImpl->mLogicalModel->mText.Clear();
-
- // We have cleared everything including the placeholder-text
- mImpl->PlaceholderCleared();
-
- mImpl->mTextUpdateInfo.mCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = 0u;
-
- // Clear any previous text.
- mImpl->mTextUpdateInfo.mClearAll = true;
-
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
-
- // Apply modifications to the model
- mImpl->mOperationsPending = ALL_OPERATIONS;
-}
+// public : Text-input Event Queuing.
-void Controller::ResetCursorPosition( CharacterIndex cursorIndex )
+void Controller::KeyboardFocusGainEvent()
{
- // Reset the cursor position
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusGainEvent" );
+
if( NULL != mImpl->mEventData )
{
- mImpl->mEventData->mPrimaryCursorPosition = cursorIndex;
-
- // Update the cursor if it's in editing mode.
- if( EventData::IsEditingState( mImpl->mEventData->mState ) )
+ if( ( EventData::INACTIVE == mImpl->mEventData->mState ) ||
+ ( EventData::INTERRUPTED == mImpl->mEventData->mState ) )
{
- mImpl->mEventData->mUpdateCursorPosition = true;
+ mImpl->ChangeState( EventData::EDITING );
+ mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
+ }
+ mImpl->NotifyImfMultiLineStatus();
+ if( mImpl->IsShowingPlaceholderText() )
+ {
+ // Show alternative placeholder-text when editing
+ ShowPlaceholderText();
}
+
+ mImpl->RequestRelayout();
}
}
-void Controller::ResetScrollPosition()
+void Controller::KeyboardFocusLostEvent()
{
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusLostEvent" );
+
if( NULL != mImpl->mEventData )
{
- // Reset the scroll position.
- mImpl->mScrollPosition = Vector2::ZERO;
- mImpl->mEventData->mScrollAfterUpdatePosition = true;
+ if( EventData::INTERRUPTED != mImpl->mEventData->mState )
+ {
+ mImpl->ChangeState( EventData::INACTIVE );
+
+ if( !mImpl->IsShowingRealText() )
+ {
+ // Revert to regular placeholder-text when not editing
+ ShowPlaceholderText();
+ }
+ }
}
+ mImpl->RequestRelayout();
}
-void Controller::TextReplacedEvent()
+bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
{
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
-
- // Apply modifications to the model
- mImpl->mOperationsPending = ALL_OPERATIONS;
-}
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyEvent" );
-void Controller::TextInsertedEvent()
-{
- DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextInsertedEvent" );
+ bool textChanged( false );
- if( NULL == mImpl->mEventData )
+ if( ( NULL != mImpl->mEventData ) &&
+ ( keyEvent.state == KeyEvent::Down ) )
{
- return;
- }
+ int keyCode = keyEvent.keyCode;
+ const std::string& keyString = keyEvent.keyPressed;
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
+ // Pre-process to separate modifying events from non-modifying input events.
+ if( Dali::DALI_KEY_ESCAPE == keyCode )
+ {
+ // Escape key is a special case which causes focus loss
+ KeyboardFocusLostEvent();
+ }
+ else if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode ) ||
+ ( Dali::DALI_KEY_CURSOR_RIGHT == keyCode ) ||
+ ( Dali::DALI_KEY_CURSOR_UP == keyCode ) ||
+ ( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) )
+ {
+ Event event( Event::CURSOR_KEY_EVENT );
+ event.p1.mInt = keyCode;
+ mImpl->mEventData->mEventQueue.push_back( event );
+ }
+ else if( Dali::DALI_KEY_BACKSPACE == keyCode )
+ {
+ textChanged = BackspaceKeyEvent();
+ }
+ else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) )
+ {
+ mImpl->ChangeState( EventData::INTERRUPTED ); // State is not INACTIVE as expect to return to edit mode.
+ // Avoids calling the InsertText() method which can delete selected text
+ }
+ else if( IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
+ IsKey( keyEvent, Dali::DALI_KEY_HOME ) )
+ {
+ mImpl->ChangeState( EventData::INACTIVE );
+ // Menu/Home key behaviour does not allow edit mode to resume like Power key
+ // Avoids calling the InsertText() method which can delete selected text
+ }
+ else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
+ {
+ // DALI_KEY_SHIFT_LEFT is the key code for the Left Shift. It's sent (by the imf?) when the predictive text is enabled
+ // and a character is typed after the type of a upper case latin character.
- // Apply modifications to the model; TODO - Optimize this
- mImpl->mOperationsPending = ALL_OPERATIONS;
-}
+ // Do nothing.
+ }
+ else
+ {
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
-void Controller::TextDeletedEvent()
-{
- DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextDeletedEvent" );
+ // IMF manager is no longer handling key-events
+ mImpl->ClearPreEditFlag();
- if( NULL == mImpl->mEventData )
- {
- return;
+ InsertText( keyString, COMMIT );
+ textChanged = true;
+ }
+
+ if ( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) &&
+ ( mImpl->mEventData->mState != EventData::INACTIVE ) &&
+ ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) )
+ {
+ // Should not change the state if the key is the shift send by the imf manager.
+ // Otherwise, when the state is SELECTING the text controller can't send the right
+ // surrounding info to the imf.
+ mImpl->ChangeState( EventData::EDITING );
+ }
+
+ mImpl->RequestRelayout();
}
- // The natural size needs to be re-calculated.
- mImpl->mRecalculateNaturalSize = true;
+ if( textChanged )
+ {
+ // Do this last since it provides callbacks into application code
+ mImpl->mControlInterface.TextChanged();
+ }
- // Apply modifications to the model; TODO - Optimize this
- mImpl->mOperationsPending = ALL_OPERATIONS;
+ return true;
}
-bool Controller::DoRelayout( const Size& size,
- OperationsMask operationsRequired,
- Size& layoutSize )
+void Controller::TapEvent( unsigned int tapCount, float x, float y )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout %p size %f,%f\n", this, size.width, size.height );
- bool viewUpdated( false );
-
- // Calculate the operations to be done.
- const OperationsMask operations = static_cast<OperationsMask>( mImpl->mOperationsPending & operationsRequired );
-
- const CharacterIndex startIndex = mImpl->mTextUpdateInfo.mParagraphCharacterIndex;
- const Length requestedNumberOfCharacters = mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters;
-
- // Get the current layout size.
- layoutSize = mImpl->mVisualModel->GetLayoutSize();
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected TapEvent" );
- if( NO_OPERATION != ( LAYOUT & operations ) )
+ if( NULL != mImpl->mEventData )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout LAYOUT & operations\n");
-
- // Some vectors with data needed to layout and reorder may be void
- // after the first time the text has been laid out.
- // Fill the vectors again.
-
- // Calculate the number of glyphs to layout.
- const Vector<GlyphIndex>& charactersToGlyph = mImpl->mVisualModel->mCharactersToGlyph;
- const Vector<Length>& glyphsPerCharacter = mImpl->mVisualModel->mGlyphsPerCharacter;
- const GlyphIndex* const charactersToGlyphBuffer = charactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = glyphsPerCharacter.Begin();
-
- const CharacterIndex lastIndex = startIndex + ( ( requestedNumberOfCharacters > 0u ) ? requestedNumberOfCharacters - 1u : 0u );
- const GlyphIndex startGlyphIndex = mImpl->mTextUpdateInfo.mStartGlyphIndex;
- const Length numberOfGlyphs = ( requestedNumberOfCharacters > 0u ) ? *( charactersToGlyphBuffer + lastIndex ) + *( glyphsPerCharacterBuffer + lastIndex ) - startGlyphIndex : 0u;
- const Length totalNumberOfGlyphs = mImpl->mVisualModel->mGlyphs.Count();
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "TapEvent state:%d \n", mImpl->mEventData->mState );
+ EventData::State state( mImpl->mEventData->mState );
+ bool relayoutNeeded( false ); // to avoid unnecessary relayouts when tapping an empty text-field
- if( 0u == totalNumberOfGlyphs )
+ if( mImpl->IsClipboardVisible() )
{
- if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
+ if( EventData::INACTIVE == state || EventData::EDITING == state)
{
- mImpl->mVisualModel->SetLayoutSize( Size::ZERO );
+ mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
}
-
- // Nothing else to do if there is no glyphs.
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated true\n" );
- return true;
+ relayoutNeeded = true;
}
-
- const Vector<LineBreakInfo>& lineBreakInfo = mImpl->mLogicalModel->mLineBreakInfo;
- const Vector<WordBreakInfo>& wordBreakInfo = mImpl->mLogicalModel->mWordBreakInfo;
- const Vector<CharacterDirection>& characterDirection = mImpl->mLogicalModel->mCharacterDirections;
- const Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
- const Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mVisualModel->mGlyphsToCharacters;
- const Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
- const Character* const textBuffer = mImpl->mLogicalModel->mText.Begin();
-
- // Set the layout parameters.
- LayoutParameters layoutParameters( size,
- textBuffer,
- lineBreakInfo.Begin(),
- wordBreakInfo.Begin(),
- ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
- glyphs.Begin(),
- glyphsToCharactersMap.Begin(),
- charactersPerGlyph.Begin(),
- charactersToGlyphBuffer,
- glyphsPerCharacterBuffer,
- totalNumberOfGlyphs );
-
- // Resize the vector of positions to have the same size than the vector of glyphs.
- Vector<Vector2>& glyphPositions = mImpl->mVisualModel->mGlyphPositions;
- glyphPositions.Resize( totalNumberOfGlyphs );
-
- // Whether the last character is a new paragraph character.
- mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + ( mImpl->mLogicalModel->mText.Count() - 1u ) ) );
- layoutParameters.isLastNewParagraph = mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph;
-
- // The initial glyph and the number of glyphs to layout.
- layoutParameters.startGlyphIndex = startGlyphIndex;
- layoutParameters.numberOfGlyphs = numberOfGlyphs;
- layoutParameters.startLineIndex = mImpl->mTextUpdateInfo.mStartLineIndex;
- layoutParameters.estimatedNumberOfLines = mImpl->mTextUpdateInfo.mEstimatedNumberOfLines;
-
- // Update the visual model.
- Size newLayoutSize;
- viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
- glyphPositions,
- mImpl->mVisualModel->mLines,
- newLayoutSize );
-
- viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );
-
- if( viewUpdated )
+ else if( 1u == tapCount )
{
- layoutSize = newLayoutSize;
-
- if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
+ if( EventData::EDITING_WITH_POPUP == state || EventData::EDITING_WITH_PASTE_POPUP == state )
{
- mImpl->mAutoScrollDirectionRTL = false;
+ mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); // If Popup shown hide it here so can be shown again if required.
}
- // Reorder the lines
- if( NO_OPERATION != ( REORDER & operations ) )
+ if( mImpl->IsShowingRealText() && ( EventData::INACTIVE != state ) )
{
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mImpl->mLogicalModel->mBidirectionalParagraphInfo;
- Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = mImpl->mLogicalModel->mBidirectionalLineInfo;
-
- // Check first if there are paragraphs with bidirectional info.
- if( 0u != bidirectionalInfo.Count() )
+ mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
+ relayoutNeeded = true;
+ }
+ else
+ {
+ if( mImpl->IsShowingPlaceholderText() && !mImpl->IsFocusedPlaceholderAvailable() )
{
- // Get the lines
- const Length numberOfLines = mImpl->mVisualModel->mLines.Count();
-
- // Reorder the lines.
- bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
- ReorderLines( bidirectionalInfo,
- startIndex,
- requestedNumberOfCharacters,
- mImpl->mVisualModel->mLines,
- bidirectionalLineInfo );
-
- // Set the bidirectional info per line into the layout parameters.
- layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
- layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
-
- // Re-layout the text. Reorder those lines with right to left characters.
- mImpl->mLayoutEngine.ReLayoutRightToLeftLines( layoutParameters,
- startIndex,
- requestedNumberOfCharacters,
- glyphPositions );
-
- if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && ( numberOfLines > 0 ) )
- {
- const LineRun* const firstline = mImpl->mVisualModel->mLines.Begin();
- if ( firstline )
- {
- mImpl->mAutoScrollDirectionRTL = firstline->direction;
- }
- }
+ // Hide placeholder text
+ ResetText();
}
- } // REORDER
- // Sets the layout size.
- if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
+ if( EventData::INACTIVE == state )
+ {
+ mImpl->ChangeState( EventData::EDITING );
+ }
+ else if( !mImpl->IsClipboardEmpty() )
+ {
+ mImpl->ChangeState( EventData::EDITING_WITH_POPUP );
+ }
+ relayoutNeeded = true;
+ }
+ }
+ else if( 2u == tapCount )
+ {
+ if( mImpl->mEventData->mSelectionEnabled &&
+ mImpl->IsShowingRealText() )
{
- mImpl->mVisualModel->SetLayoutSize( layoutSize );
+ SelectEvent( x, y, false );
}
- } // view updated
+ }
+ // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
+ if( relayoutNeeded )
+ {
+ Event event( Event::TAP_EVENT );
+ event.p1.mUint = tapCount;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
- // Store the size used to layout the text.
- mImpl->mVisualModel->mControlSize = size;
+ mImpl->RequestRelayout();
+ }
}
- if( NO_OPERATION != ( ALIGN & operations ) )
- {
- // The laid-out lines.
- Vector<LineRun>& lines = mImpl->mVisualModel->mLines;
-
- mImpl->mLayoutEngine.Align( size,
- startIndex,
- requestedNumberOfCharacters,
- lines );
-
- viewUpdated = true;
- }
-#if defined(DEBUG_ENABLED)
- std::string currentText;
- GetText( currentText );
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::DoRelayout [%p] mImpl->mAutoScrollDirectionRTL[%s] [%s]\n", this, (mImpl->mAutoScrollDirectionRTL)?"true":"false", currentText.c_str() );
-#endif
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout, view updated %s\n", ( viewUpdated ? "true" : "false" ) );
- return viewUpdated;
+ // Reset keyboard as tap event has occurred.
+ mImpl->ResetImfManager();
}
-void Controller::SetMultiLineEnabled( bool enable )
+void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
{
- const LayoutEngine::Layout layout = enable ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" );
- if( layout != mImpl->mLayoutEngine.GetLayout() )
+ if( NULL != mImpl->mEventData )
{
- // Set the layout type.
- mImpl->mLayoutEngine.SetLayout( layout );
-
- // Set the flags to redo the layout operations
- const OperationsMask layoutOperations = static_cast<OperationsMask>( LAYOUT |
- UPDATE_LAYOUT_SIZE |
- ALIGN |
- REORDER );
-
- mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | layoutOperations );
+ Event event( Event::PAN_EVENT );
+ event.p1.mInt = state;
+ event.p2.mFloat = displacement.x;
+ event.p3.mFloat = displacement.y;
+ mImpl->mEventData->mEventQueue.push_back( event );
mImpl->RequestRelayout();
}
}
-bool Controller::IsMultiLineEnabled() const
+void Controller::LongPressEvent( Gesture::State state, float x, float y )
{
- return LayoutEngine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
-}
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected LongPressEvent" );
-void Controller::SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment )
-{
- if( alignment != mImpl->mLayoutEngine.GetHorizontalAlignment() )
+ if( ( state == Gesture::Started ) &&
+ ( NULL != mImpl->mEventData ) )
{
- // Set the alignment.
- mImpl->mLayoutEngine.SetHorizontalAlignment( alignment );
-
- // Set the flag to redo the alignment operation.
- mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
-
- mImpl->RequestRelayout();
- }
-}
-
-LayoutEngine::HorizontalAlignment Controller::GetHorizontalAlignment() const
-{
- return mImpl->mLayoutEngine.GetHorizontalAlignment();
-}
+ if( !mImpl->IsShowingRealText() )
+ {
+ Event event( Event::LONG_PRESS_EVENT );
+ event.p1.mInt = state;
+ mImpl->mEventData->mEventQueue.push_back( event );
+ mImpl->RequestRelayout();
+ }
+ else
+ {
+ // The 1st long-press on inactive text-field is treated as tap
+ if( EventData::INACTIVE == mImpl->mEventData->mState )
+ {
+ mImpl->ChangeState( EventData::EDITING );
-void Controller::SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment )
-{
- if( alignment != mImpl->mLayoutEngine.GetVerticalAlignment() )
- {
- // Set the alignment.
- mImpl->mLayoutEngine.SetVerticalAlignment( alignment );
+ Event event( Event::TAP_EVENT );
+ event.p1.mUint = 1;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
- mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
+ mImpl->RequestRelayout();
+ }
+ else if( !mImpl->IsClipboardVisible() )
+ {
+ // Reset the imf manger to commit the pre-edit before selecting the text.
+ mImpl->ResetImfManager();
- mImpl->RequestRelayout();
+ SelectEvent( x, y, false );
+ }
+ }
}
}
-LayoutEngine::VerticalAlignment Controller::GetVerticalAlignment() const
+ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
{
- return mImpl->mLayoutEngine.GetVerticalAlignment();
-}
+ // Whether the text needs to be relaid-out.
+ bool requestRelayout = false;
-void Controller::CalculateVerticalOffset( const Size& controlSize )
-{
- Size layoutSize = mImpl->mVisualModel->GetLayoutSize();
-
- if( fabsf( layoutSize.height ) < Math::MACHINE_EPSILON_1000 )
- {
- // Get the line height of the default font.
- layoutSize.height = mImpl->GetDefaultFontLineHeight();
- }
+ // Whether to retrieve the text and cursor position to be sent to the IMF manager.
+ bool retrieveText = false;
+ bool retrieveCursor = false;
- switch( mImpl->mLayoutEngine.GetVerticalAlignment() )
+ switch( imfEvent.eventName )
{
- case LayoutEngine::VERTICAL_ALIGN_TOP:
+ case ImfManager::COMMIT:
{
- mImpl->mScrollPosition.y = 0.f;
+ InsertText( imfEvent.predictiveString, Text::Controller::COMMIT );
+ requestRelayout = true;
+ retrieveCursor = true;
break;
}
- case LayoutEngine::VERTICAL_ALIGN_CENTER:
+ case ImfManager::PREEDIT:
{
- mImpl->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
+ InsertText( imfEvent.predictiveString, Text::Controller::PRE_EDIT );
+ requestRelayout = true;
+ retrieveCursor = true;
break;
}
- case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
+ case ImfManager::DELETESURROUNDING:
{
- mImpl->mScrollPosition.y = controlSize.height - layoutSize.height;
- break;
- }
- }
-}
-
-LayoutEngine& Controller::GetLayoutEngine()
-{
- return mImpl->mLayoutEngine;
-}
-
-View& Controller::GetView()
-{
- return mImpl->mView;
-}
+ const bool textDeleted = RemoveText( imfEvent.cursorOffset,
+ imfEvent.numberOfChars,
+ DONT_UPDATE_INPUT_STYLE );
-void Controller::KeyboardFocusGainEvent()
-{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusGainEvent" );
+ if( textDeleted )
+ {
+ if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
+ !mImpl->IsPlaceholderAvailable() )
+ {
+ mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
+ }
+ else
+ {
+ ShowPlaceholderText();
+ }
+ mImpl->mEventData->mUpdateCursorPosition = true;
+ mImpl->mEventData->mScrollAfterDelete = true;
- if( NULL != mImpl->mEventData )
- {
- if( ( EventData::INACTIVE == mImpl->mEventData->mState ) ||
- ( EventData::INTERRUPTED == mImpl->mEventData->mState ) )
+ requestRelayout = true;
+ }
+ break;
+ }
+ case ImfManager::GETSURROUNDING:
{
- mImpl->ChangeState( EventData::EDITING );
- mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
+ retrieveText = true;
+ retrieveCursor = true;
+ break;
}
-
- if( mImpl->IsShowingPlaceholderText() )
+ case ImfManager::VOID:
{
- // Show alternative placeholder-text when editing
- ShowPlaceholderText();
+ // do nothing
+ break;
}
+ } // end switch
+ if( requestRelayout )
+ {
+ mImpl->mOperationsPending = ALL_OPERATIONS;
mImpl->RequestRelayout();
}
-}
-void Controller::KeyboardFocusLostEvent()
-{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyboardFocusLostEvent" );
+ std::string text;
+ CharacterIndex cursorPosition = 0u;
+ Length numberOfWhiteSpaces = 0u;
- if( NULL != mImpl->mEventData )
+ if( retrieveCursor )
{
- if( EventData::INTERRUPTED != mImpl->mEventData->mState )
- {
- mImpl->ChangeState( EventData::INACTIVE );
-
- if( !mImpl->IsShowingRealText() )
- {
- // Revert to regular placeholder-text when not editing
- ShowPlaceholderText();
- }
- }
- }
- mImpl->RequestRelayout();
-}
-
-bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent )
-{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyEvent" );
-
- bool textChanged( false );
+ numberOfWhiteSpaces = mImpl->GetNumberOfWhiteSpaces( 0u );
- if( ( NULL != mImpl->mEventData ) &&
- ( keyEvent.state == KeyEvent::Down ) )
- {
- int keyCode = keyEvent.keyCode;
- const std::string& keyString = keyEvent.keyPressed;
+ cursorPosition = mImpl->GetLogicalCursorPosition();
- // Pre-process to separate modifying events from non-modifying input events.
- if( Dali::DALI_KEY_ESCAPE == keyCode )
- {
- // Escape key is a special case which causes focus loss
- KeyboardFocusLostEvent();
- }
- else if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode ) ||
- ( Dali::DALI_KEY_CURSOR_RIGHT == keyCode ) ||
- ( Dali::DALI_KEY_CURSOR_UP == keyCode ) ||
- ( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) )
- {
- Event event( Event::CURSOR_KEY_EVENT );
- event.p1.mInt = keyCode;
- mImpl->mEventData->mEventQueue.push_back( event );
- }
- else if( Dali::DALI_KEY_BACKSPACE == keyCode )
- {
- textChanged = BackspaceKeyEvent();
- }
- else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) )
- {
- mImpl->ChangeState( EventData::INTERRUPTED ); // State is not INACTIVE as expect to return to edit mode.
- // Avoids calling the InsertText() method which can delete selected text
- }
- else if( IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
- IsKey( keyEvent, Dali::DALI_KEY_HOME ) )
- {
- mImpl->ChangeState( EventData::INACTIVE );
- // Menu/Home key behaviour does not allow edit mode to resume like Power key
- // Avoids calling the InsertText() method which can delete selected text
- }
- else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
+ if( cursorPosition < numberOfWhiteSpaces )
{
- // DALI_KEY_SHIFT_LEFT is the key code for the Left Shift. It's sent (by the imf?) when the predictive text is enabled
- // and a character is typed after the type of a upper case latin character.
-
- // Do nothing.
+ cursorPosition = 0u;
}
else
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
-
- // IMF manager is no longer handling key-events
- mImpl->ClearPreEditFlag();
-
- InsertText( keyString, COMMIT );
- textChanged = true;
- }
-
- if ( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) &&
- ( mImpl->mEventData->mState != EventData::INACTIVE ) &&
- ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) )
- {
- // Should not change the state if the key is the shift send by the imf manager.
- // Otherwise, when the state is SELECTING the text controller can't send the right
- // surrounding info to the imf.
- mImpl->ChangeState( EventData::EDITING );
+ cursorPosition -= numberOfWhiteSpaces;
}
+ }
- mImpl->RequestRelayout();
+ if( retrieveText )
+ {
+ mImpl->GetText( numberOfWhiteSpaces, text );
}
- if( textChanged )
+ ImfManager::ImfCallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
+
+ if( requestRelayout )
{
// Do this last since it provides callbacks into application code
mImpl->mControlInterface.TextChanged();
}
- return true;
+ return callbackData;
}
-void Controller::InsertText( const std::string& text, Controller::InsertType type )
+void Controller::PasteClipboardItemEvent()
{
- bool removedPrevious( false );
- bool maxLengthReached( false );
+ // Retrieve the clipboard contents first
+ ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+ std::string stringToPaste( notifier.GetContent() );
- DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected InsertText" )
+ // Commit the current pre-edit text; the contents of the clipboard should be appended
+ mImpl->ResetImfManager();
- if( NULL == mImpl->mEventData )
- {
- return;
- }
+ // Temporary disable hiding clipboard
+ mImpl->SetClipboardHideEnable( false );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::InsertText %p %s (%s) mPrimaryCursorPosition %d mPreEditFlag %d mPreEditStartPosition %d mPreEditLength %d\n",
- this, text.c_str(), (COMMIT == type ? "COMMIT" : "PRE_EDIT"),
- mImpl->mEventData->mPrimaryCursorPosition, mImpl->mEventData->mPreEditFlag, mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength );
+ // Paste
+ PasteText( stringToPaste );
- // TODO: At the moment the underline runs are only for pre-edit.
- mImpl->mVisualModel->mUnderlineRuns.Clear();
+ mImpl->SetClipboardHideEnable( true );
+}
- // Keep the current number of characters.
- const Length currentNumberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mLogicalModel->mText.Count() : 0u;
+// protected : Inherit from Text::Decorator::ControllerInterface.
- // Remove the previous IMF pre-edit.
- if( mImpl->mEventData->mPreEditFlag && ( 0u != mImpl->mEventData->mPreEditLength ) )
- {
- removedPrevious = RemoveText( -static_cast<int>( mImpl->mEventData->mPrimaryCursorPosition - mImpl->mEventData->mPreEditStartPosition ),
- mImpl->mEventData->mPreEditLength,
- DONT_UPDATE_INPUT_STYLE );
+void Controller::GetTargetSize( Vector2& targetSize )
+{
+ targetSize = mImpl->mVisualModel->mControlSize;
+}
- mImpl->mEventData->mPrimaryCursorPosition = mImpl->mEventData->mPreEditStartPosition;
- mImpl->mEventData->mPreEditLength = 0u;
- }
- else
- {
- // Remove the previous Selection.
- removedPrevious = RemoveSelectedText();
- }
+void Controller::AddDecoration( Actor& actor, bool needsClipping )
+{
+ mImpl->mControlInterface.AddDecoration( actor, needsClipping );
+}
- Vector<Character> utf32Characters;
- Length characterCount = 0u;
+void Controller::DecorationEvent( HandleType handleType, HandleState state, float x, float y )
+{
+ DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected DecorationEvent" );
- if( !text.empty() )
+ if( NULL != mImpl->mEventData )
{
- // Convert text into UTF-32
- utf32Characters.Resize( text.size() );
-
- // This is a bit horrible but std::string returns a (signed) char*
- const uint8_t* utf8 = reinterpret_cast<const uint8_t*>( text.c_str() );
+ switch( handleType )
+ {
+ case GRAB_HANDLE:
+ {
+ Event event( Event::GRAB_HANDLE_EVENT );
+ event.p1.mUint = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
- // Transform a text array encoded in utf8 into an array encoded in utf32.
+ mImpl->mEventData->mEventQueue.push_back( event );
+ break;
+ }
+ case LEFT_SELECTION_HANDLE:
+ {
+ Event event( Event::LEFT_SELECTION_HANDLE_EVENT );
+ event.p1.mUint = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+
+ mImpl->mEventData->mEventQueue.push_back( event );
+ break;
+ }
+ case RIGHT_SELECTION_HANDLE:
+ {
+ Event event( Event::RIGHT_SELECTION_HANDLE_EVENT );
+ event.p1.mUint = state;
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+
+ mImpl->mEventData->mEventQueue.push_back( event );
+ break;
+ }
+ case LEFT_SELECTION_HANDLE_MARKER:
+ case RIGHT_SELECTION_HANDLE_MARKER:
+ {
+ // Markers do not move the handles.
+ break;
+ }
+ case HANDLE_TYPE_COUNT:
+ {
+ DALI_ASSERT_DEBUG( !"Controller::HandleEvent. Unexpected handle type" );
+ }
+ }
+
+ mImpl->RequestRelayout();
+ }
+}
+
+// protected : Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
+
+void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button )
+{
+ if( NULL == mImpl->mEventData )
+ {
+ return;
+ }
+
+ switch( button )
+ {
+ case Toolkit::TextSelectionPopup::CUT:
+ {
+ mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+
+ if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
+ !mImpl->IsPlaceholderAvailable() )
+ {
+ mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
+ }
+ else
+ {
+ ShowPlaceholderText();
+ }
+
+ mImpl->mEventData->mUpdateCursorPosition = true;
+ mImpl->mEventData->mScrollAfterDelete = true;
+
+ mImpl->RequestRelayout();
+ mImpl->mControlInterface.TextChanged();
+ break;
+ }
+ case Toolkit::TextSelectionPopup::COPY:
+ {
+ mImpl->SendSelectionToClipboard( false ); // Text not modified
+
+ mImpl->mEventData->mUpdateCursorPosition = true;
+
+ mImpl->RequestRelayout(); // Cursor, Handles, Selection Highlight, Popup
+ break;
+ }
+ case Toolkit::TextSelectionPopup::PASTE:
+ {
+ mImpl->RequestGetTextFromClipboard(); // Request clipboard service to retrieve an item
+ break;
+ }
+ case Toolkit::TextSelectionPopup::SELECT:
+ {
+ const Vector2& currentCursorPosition = mImpl->mEventData->mDecorator->GetPosition( PRIMARY_CURSOR );
+
+ if( mImpl->mEventData->mSelectionEnabled )
+ {
+ // Creates a SELECT event.
+ SelectEvent( currentCursorPosition.x, currentCursorPosition.y, false );
+ }
+ break;
+ }
+ case Toolkit::TextSelectionPopup::SELECT_ALL:
+ {
+ // Creates a SELECT_ALL event
+ SelectEvent( 0.f, 0.f, true );
+ break;
+ }
+ case Toolkit::TextSelectionPopup::CLIPBOARD:
+ {
+ mImpl->ShowClipboard();
+ break;
+ }
+ case Toolkit::TextSelectionPopup::NONE:
+ {
+ // Nothing to do.
+ break;
+ }
+ }
+}
+
+// private : Update.
+
+void Controller::InsertText( const std::string& text, Controller::InsertType type )
+{
+ bool removedPrevious( false );
+ bool maxLengthReached( false );
+
+ DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected InsertText" )
+
+ if( NULL == mImpl->mEventData )
+ {
+ return;
+ }
+
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::InsertText %p %s (%s) mPrimaryCursorPosition %d mPreEditFlag %d mPreEditStartPosition %d mPreEditLength %d\n",
+ this, text.c_str(), (COMMIT == type ? "COMMIT" : "PRE_EDIT"),
+ mImpl->mEventData->mPrimaryCursorPosition, mImpl->mEventData->mPreEditFlag, mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength );
+
+ // TODO: At the moment the underline runs are only for pre-edit.
+ mImpl->mVisualModel->mUnderlineRuns.Clear();
+
+ // Keep the current number of characters.
+ const Length currentNumberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mLogicalModel->mText.Count() : 0u;
+
+ // Remove the previous IMF pre-edit.
+ if( mImpl->mEventData->mPreEditFlag && ( 0u != mImpl->mEventData->mPreEditLength ) )
+ {
+ removedPrevious = RemoveText( -static_cast<int>( mImpl->mEventData->mPrimaryCursorPosition - mImpl->mEventData->mPreEditStartPosition ),
+ mImpl->mEventData->mPreEditLength,
+ DONT_UPDATE_INPUT_STYLE );
+
+ mImpl->mEventData->mPrimaryCursorPosition = mImpl->mEventData->mPreEditStartPosition;
+ mImpl->mEventData->mPreEditLength = 0u;
+ }
+ else
+ {
+ // Remove the previous Selection.
+ removedPrevious = RemoveSelectedText();
+ }
+
+ Vector<Character> utf32Characters;
+ Length characterCount = 0u;
+
+ if( !text.empty() )
+ {
+ // Convert text into UTF-32
+ utf32Characters.Resize( text.size() );
+
+ // This is a bit horrible but std::string returns a (signed) char*
+ const uint8_t* utf8 = reinterpret_cast<const uint8_t*>( text.c_str() );
+
+ // Transform a text array encoded in utf8 into an array encoded in utf32.
// It returns the actual number of characters.
characterCount = Utf8ToUtf32( utf8, text.size(), utf32Characters.Begin() );
utf32Characters.Resize( characterCount );
}
}
+void Controller::PasteText( const std::string& stringToPaste )
+{
+ InsertText( stringToPaste, Text::Controller::COMMIT );
+ mImpl->ChangeState( EventData::EDITING );
+ mImpl->RequestRelayout();
+
+ // Do this last since it provides callbacks into application code
+ mImpl->mControlInterface.TextChanged();
+}
+
+bool Controller::RemoveText( int cursorOffset,
+ int numberOfCharacters,
+ UpdateInputStyleType type )
+{
+ bool removed = false;
+
+ if( NULL == mImpl->mEventData )
+ {
+ return removed;
+ }
+
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfCharacters %d\n",
+ this, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfCharacters );
+
+ if( !mImpl->IsShowingPlaceholderText() )
+ {
+ // Delete at current cursor position
+ Vector<Character>& currentText = mImpl->mLogicalModel->mText;
+ CharacterIndex& oldCursorIndex = mImpl->mEventData->mPrimaryCursorPosition;
+
+ CharacterIndex cursorIndex = oldCursorIndex;
+
+ // Validate the cursor position & number of characters
+ if( static_cast< CharacterIndex >( std::abs( cursorOffset ) ) <= cursorIndex )
+ {
+ cursorIndex = oldCursorIndex + cursorOffset;
+ }
+
+ if( ( cursorIndex + numberOfCharacters ) > currentText.Count() )
+ {
+ numberOfCharacters = currentText.Count() - cursorIndex;
+ }
+
+ if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters )
+ {
+ // Mark the paragraphs to be updated.
+ 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.
+
+ if( UPDATE_INPUT_STYLE == type )
+ {
+ // Keep a copy of the current input style.
+ InputStyle currentInputStyle;
+ currentInputStyle.Copy( mImpl->mEventData->mInputStyle );
+
+ // Set first the default input style.
+ mImpl->RetrieveDefaultInputStyle( mImpl->mEventData->mInputStyle );
+
+ // Update the input style.
+ mImpl->mLogicalModel->RetrieveStyle( cursorIndex, mImpl->mEventData->mInputStyle );
+
+ // Compare if the input style has changed.
+ const bool hasInputStyleChanged = !currentInputStyle.Equal( mImpl->mEventData->mInputStyle );
+
+ if( hasInputStyleChanged )
+ {
+ const InputStyle::Mask styleChangedMask = currentInputStyle.GetInputStyleChangeMask( mImpl->mEventData->mInputStyle );
+ // Queue the input style changed signal.
+ mImpl->mEventData->mInputStyleChangedQueue.PushBack( styleChangedMask );
+ }
+ }
+
+ // Updates the text style runs by removing characters. Runs with no characters are removed.
+ mImpl->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
+
+ // Remove the characters.
+ Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
+ Vector<Character>::Iterator last = first + numberOfCharacters;
+
+ currentText.Erase( first, last );
+
+ // Cursor position retreat
+ oldCursorIndex = cursorIndex;
+
+ mImpl->mEventData->mScrollAfterDelete = true;
+
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p removed %d\n", this, numberOfCharacters );
+ removed = true;
+ }
+ }
+
+ return removed;
+}
+
bool Controller::RemoveSelectedText()
{
bool textRemoved( false );
return textRemoved;
}
-void Controller::TapEvent( unsigned int tapCount, float x, float y )
-{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected TapEvent" );
+// private : Relayout.
- if( NULL != mImpl->mEventData )
- {
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "TapEvent state:%d \n", mImpl->mEventData->mState );
-
- if( 1u == tapCount )
- {
- // This is to avoid unnecessary relayouts when tapping an empty text-field
- bool relayoutNeeded( false );
-
- if( ( EventData::EDITING_WITH_POPUP == mImpl->mEventData->mState ) ||
- ( EventData::EDITING_WITH_PASTE_POPUP == mImpl->mEventData->mState ) )
- {
- mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE ); // If Popup shown hide it here so can be shown again if required.
- }
-
- if( mImpl->IsShowingRealText() && ( EventData::INACTIVE != mImpl->mEventData->mState ) )
- {
- // Already in an active state so show a popup
- if( !mImpl->IsClipboardEmpty() )
- {
- // Shows Paste popup but could show full popup with Selection options. ( EDITING_WITH_POPUP )
- mImpl->ChangeState( EventData::EDITING_WITH_PASTE_POPUP );
- }
- else
- {
- // Show cursor and grabhandle on first tap, this matches the behaviour of tapping when already editing
- mImpl->ChangeState( EventData::EDITING_WITH_GRAB_HANDLE );
- }
- relayoutNeeded = true;
- }
- else
- {
- if( mImpl->IsShowingPlaceholderText() && !mImpl->IsFocusedPlaceholderAvailable() )
- {
- // Hide placeholder text
- ResetText();
- }
-
- if( EventData::INACTIVE == mImpl->mEventData->mState )
- {
- mImpl->ChangeState( EventData::EDITING );
- }
- else if( !mImpl->IsClipboardEmpty() )
- {
- mImpl->ChangeState( EventData::EDITING_WITH_POPUP );
- }
- relayoutNeeded = true;
- }
-
- // Handles & cursors must be repositioned after Relayout() i.e. after the Model has been updated
- if( relayoutNeeded )
- {
- Event event( Event::TAP_EVENT );
- event.p1.mUint = tapCount;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
+bool Controller::DoRelayout( const Size& size,
+ OperationsMask operationsRequired,
+ Size& layoutSize )
+{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout %p size %f,%f\n", this, size.width, size.height );
+ bool viewUpdated( false );
- mImpl->RequestRelayout();
- }
- }
- else if( 2u == tapCount )
- {
- if( mImpl->mEventData->mSelectionEnabled &&
- mImpl->IsShowingRealText() )
- {
- SelectEvent( x, y, false );
- }
- }
- }
+ // Calculate the operations to be done.
+ const OperationsMask operations = static_cast<OperationsMask>( mImpl->mOperationsPending & operationsRequired );
- // Reset keyboard as tap event has occurred.
- mImpl->ResetImfManager();
-}
+ const CharacterIndex startIndex = mImpl->mTextUpdateInfo.mParagraphCharacterIndex;
+ const Length requestedNumberOfCharacters = mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters;
-void Controller::PanEvent( Gesture::State state, const Vector2& displacement )
-{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" );
+ // Get the current layout size.
+ layoutSize = mImpl->mVisualModel->GetLayoutSize();
- if( NULL != mImpl->mEventData )
+ if( NO_OPERATION != ( LAYOUT & operations ) )
{
- Event event( Event::PAN_EVENT );
- event.p1.mInt = state;
- event.p2.mFloat = displacement.x;
- event.p3.mFloat = displacement.y;
- mImpl->mEventData->mEventQueue.push_back( event );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout LAYOUT & operations\n");
- mImpl->RequestRelayout();
- }
-}
+ // Some vectors with data needed to layout and reorder may be void
+ // after the first time the text has been laid out.
+ // Fill the vectors again.
-void Controller::LongPressEvent( Gesture::State state, float x, float y )
-{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected LongPressEvent" );
+ // Calculate the number of glyphs to layout.
+ const Vector<GlyphIndex>& charactersToGlyph = mImpl->mVisualModel->mCharactersToGlyph;
+ const Vector<Length>& glyphsPerCharacter = mImpl->mVisualModel->mGlyphsPerCharacter;
+ const GlyphIndex* const charactersToGlyphBuffer = charactersToGlyph.Begin();
+ const Length* const glyphsPerCharacterBuffer = glyphsPerCharacter.Begin();
- if( ( state == Gesture::Started ) &&
- ( NULL != mImpl->mEventData ) )
- {
- if( !mImpl->IsShowingRealText() )
- {
- Event event( Event::LONG_PRESS_EVENT );
- event.p1.mInt = state;
- mImpl->mEventData->mEventQueue.push_back( event );
- mImpl->RequestRelayout();
- }
- else
+ const CharacterIndex lastIndex = startIndex + ( ( requestedNumberOfCharacters > 0u ) ? requestedNumberOfCharacters - 1u : 0u );
+ const GlyphIndex startGlyphIndex = mImpl->mTextUpdateInfo.mStartGlyphIndex;
+ const Length numberOfGlyphs = ( requestedNumberOfCharacters > 0u ) ? *( charactersToGlyphBuffer + lastIndex ) + *( glyphsPerCharacterBuffer + lastIndex ) - startGlyphIndex : 0u;
+ const Length totalNumberOfGlyphs = mImpl->mVisualModel->mGlyphs.Count();
+
+ if( 0u == totalNumberOfGlyphs )
{
- // The 1st long-press on inactive text-field is treated as tap
- if( EventData::INACTIVE == mImpl->mEventData->mState )
+ if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
{
- mImpl->ChangeState( EventData::EDITING );
-
- Event event( Event::TAP_EVENT );
- event.p1.mUint = 1;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
-
- mImpl->RequestRelayout();
+ mImpl->mVisualModel->SetLayoutSize( Size::ZERO );
}
- else
- {
- // Reset the imf manger to commit the pre-edit before selecting the text.
- mImpl->ResetImfManager();
- SelectEvent( x, y, false );
- }
+ // Nothing else to do if there is no glyphs.
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout no glyphs, view updated true\n" );
+ return true;
}
- }
-}
-void Controller::SelectEvent( float x, float y, bool selectAll )
-{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SelectEvent\n" );
+ const Vector<LineBreakInfo>& lineBreakInfo = mImpl->mLogicalModel->mLineBreakInfo;
+ const Vector<WordBreakInfo>& wordBreakInfo = mImpl->mLogicalModel->mWordBreakInfo;
+ const Vector<CharacterDirection>& characterDirection = mImpl->mLogicalModel->mCharacterDirections;
+ const Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
+ const Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mVisualModel->mGlyphsToCharacters;
+ const Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
+ const Character* const textBuffer = mImpl->mLogicalModel->mText.Begin();
- if( NULL != mImpl->mEventData )
- {
- if( selectAll )
- {
- Event event( Event::SELECT_ALL );
- mImpl->mEventData->mEventQueue.push_back( event );
- }
- else
- {
- Event event( Event::SELECT );
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
- }
+ // Set the layout parameters.
+ LayoutParameters layoutParameters( size,
+ textBuffer,
+ lineBreakInfo.Begin(),
+ wordBreakInfo.Begin(),
+ ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
+ glyphs.Begin(),
+ glyphsToCharactersMap.Begin(),
+ charactersPerGlyph.Begin(),
+ charactersToGlyphBuffer,
+ glyphsPerCharacterBuffer,
+ totalNumberOfGlyphs );
- mImpl->RequestRelayout();
- }
-}
+ // Resize the vector of positions to have the same size than the vector of glyphs.
+ Vector<Vector2>& glyphPositions = mImpl->mVisualModel->mGlyphPositions;
+ glyphPositions.Resize( totalNumberOfGlyphs );
-void Controller::GetTargetSize( Vector2& targetSize )
-{
- targetSize = mImpl->mVisualModel->mControlSize;
-}
+ // Whether the last character is a new paragraph character.
+ mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + ( mImpl->mLogicalModel->mText.Count() - 1u ) ) );
+ layoutParameters.isLastNewParagraph = mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph;
-void Controller::AddDecoration( Actor& actor, bool needsClipping )
-{
- mImpl->mControlInterface.AddDecoration( actor, needsClipping );
-}
+ // The initial glyph and the number of glyphs to layout.
+ layoutParameters.startGlyphIndex = startGlyphIndex;
+ layoutParameters.numberOfGlyphs = numberOfGlyphs;
+ layoutParameters.startLineIndex = mImpl->mTextUpdateInfo.mStartLineIndex;
+ layoutParameters.estimatedNumberOfLines = mImpl->mTextUpdateInfo.mEstimatedNumberOfLines;
-void Controller::DecorationEvent( HandleType handleType, HandleState state, float x, float y )
-{
- DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected DecorationEvent" );
+ // Update the visual model.
+ Size newLayoutSize;
+ viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
+ glyphPositions,
+ mImpl->mVisualModel->mLines,
+ newLayoutSize );
- if( NULL != mImpl->mEventData )
- {
- switch( handleType )
+ viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );
+
+ if( viewUpdated )
{
- case GRAB_HANDLE:
- {
- Event event( Event::GRAB_HANDLE_EVENT );
- event.p1.mUint = state;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
+ layoutSize = newLayoutSize;
- mImpl->mEventData->mEventQueue.push_back( event );
- break;
- }
- case LEFT_SELECTION_HANDLE:
+ if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
{
- Event event( Event::LEFT_SELECTION_HANDLE_EVENT );
- event.p1.mUint = state;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
-
- mImpl->mEventData->mEventQueue.push_back( event );
- break;
+ mImpl->mAutoScrollDirectionRTL = false;
}
- case RIGHT_SELECTION_HANDLE:
- {
- Event event( Event::RIGHT_SELECTION_HANDLE_EVENT );
- event.p1.mUint = state;
- event.p2.mFloat = x;
- event.p3.mFloat = y;
- mImpl->mEventData->mEventQueue.push_back( event );
- break;
- }
- case LEFT_SELECTION_HANDLE_MARKER:
- case RIGHT_SELECTION_HANDLE_MARKER:
- {
- // Markers do not move the handles.
- break;
- }
- case HANDLE_TYPE_COUNT:
+ // Reorder the lines
+ if( NO_OPERATION != ( REORDER & operations ) )
{
- DALI_ASSERT_DEBUG( !"Controller::HandleEvent. Unexpected handle type" );
- }
- }
-
- mImpl->RequestRelayout();
- }
-}
-
-void Controller::PasteText( const std::string& stringToPaste )
-{
- InsertText( stringToPaste, Text::Controller::COMMIT );
- mImpl->ChangeState( EventData::EDITING );
- mImpl->RequestRelayout();
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mImpl->mLogicalModel->mBidirectionalParagraphInfo;
+ Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = mImpl->mLogicalModel->mBidirectionalLineInfo;
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
-}
+ // Check first if there are paragraphs with bidirectional info.
+ if( 0u != bidirectionalInfo.Count() )
+ {
+ // Get the lines
+ const Length numberOfLines = mImpl->mVisualModel->mLines.Count();
-void Controller::PasteClipboardItemEvent()
-{
- // Retrieve the clipboard contents first
- ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
- std::string stringToPaste( notifier.GetContent() );
+ // Reorder the lines.
+ bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
+ ReorderLines( bidirectionalInfo,
+ startIndex,
+ requestedNumberOfCharacters,
+ mImpl->mVisualModel->mLines,
+ bidirectionalLineInfo );
- // Commit the current pre-edit text; the contents of the clipboard should be appended
- mImpl->ResetImfManager();
+ // Set the bidirectional info per line into the layout parameters.
+ layoutParameters.lineBidirectionalInfoRunsBuffer = bidirectionalLineInfo.Begin();
+ layoutParameters.numberOfBidirectionalInfoRuns = bidirectionalLineInfo.Count();
- // Temporary disable hiding clipboard
- mImpl->SetClipboardHideEnable( false );
+ // Re-layout the text. Reorder those lines with right to left characters.
+ mImpl->mLayoutEngine.ReLayoutRightToLeftLines( layoutParameters,
+ startIndex,
+ requestedNumberOfCharacters,
+ glyphPositions );
- // Paste
- PasteText( stringToPaste );
+ if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && ( numberOfLines > 0 ) )
+ {
+ const LineRun* const firstline = mImpl->mVisualModel->mLines.Begin();
+ if ( firstline )
+ {
+ mImpl->mAutoScrollDirectionRTL = firstline->direction;
+ }
+ }
+ }
+ } // REORDER
- mImpl->SetClipboardHideEnable( true );
-}
+ // Sets the layout size.
+ if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
+ {
+ mImpl->mVisualModel->SetLayoutSize( layoutSize );
+ }
+ } // view updated
-void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button )
-{
- if( NULL == mImpl->mEventData )
- {
- return;
+ // Store the size used to layout the text.
+ mImpl->mVisualModel->mControlSize = size;
}
- switch( button )
+ if( NO_OPERATION != ( ALIGN & operations ) )
{
- case Toolkit::TextSelectionPopup::CUT:
- {
- mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
- mImpl->mOperationsPending = ALL_OPERATIONS;
-
- if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
- !mImpl->IsPlaceholderAvailable() )
- {
- mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
- }
- else
- {
- ShowPlaceholderText();
- }
+ // The laid-out lines.
+ Vector<LineRun>& lines = mImpl->mVisualModel->mLines;
- mImpl->mEventData->mUpdateCursorPosition = true;
- mImpl->mEventData->mScrollAfterDelete = true;
+ mImpl->mLayoutEngine.Align( size,
+ startIndex,
+ requestedNumberOfCharacters,
+ lines );
- mImpl->RequestRelayout();
- mImpl->mControlInterface.TextChanged();
- break;
- }
- case Toolkit::TextSelectionPopup::COPY:
- {
- mImpl->SendSelectionToClipboard( false ); // Text not modified
+ viewUpdated = true;
+ }
+#if defined(DEBUG_ENABLED)
+ std::string currentText;
+ GetText( currentText );
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "Controller::DoRelayout [%p] mImpl->mAutoScrollDirectionRTL[%s] [%s]\n", this, (mImpl->mAutoScrollDirectionRTL)?"true":"false", currentText.c_str() );
+#endif
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::DoRelayout, view updated %s\n", ( viewUpdated ? "true" : "false" ) );
+ return viewUpdated;
+}
- mImpl->mEventData->mUpdateCursorPosition = true;
+void Controller::CalculateVerticalOffset( const Size& controlSize )
+{
+ Size layoutSize = mImpl->mVisualModel->GetLayoutSize();
- mImpl->RequestRelayout(); // Cursor, Handles, Selection Highlight, Popup
- break;
- }
- case Toolkit::TextSelectionPopup::PASTE:
- {
- std::string stringToPaste("");
- mImpl->GetTextFromClipboard( 0, stringToPaste ); // Paste latest item from system clipboard
- PasteText( stringToPaste );
- break;
- }
- case Toolkit::TextSelectionPopup::SELECT:
- {
- const Vector2& currentCursorPosition = mImpl->mEventData->mDecorator->GetPosition( PRIMARY_CURSOR );
+ if( fabsf( layoutSize.height ) < Math::MACHINE_EPSILON_1000 )
+ {
+ // Get the line height of the default font.
+ layoutSize.height = mImpl->GetDefaultFontLineHeight();
+ }
- if( mImpl->mEventData->mSelectionEnabled )
- {
- // Creates a SELECT event.
- SelectEvent( currentCursorPosition.x, currentCursorPosition.y, false );
- }
- break;
- }
- case Toolkit::TextSelectionPopup::SELECT_ALL:
+ switch( mImpl->mLayoutEngine.GetVerticalAlignment() )
+ {
+ case LayoutEngine::VERTICAL_ALIGN_TOP:
{
- // Creates a SELECT_ALL event
- SelectEvent( 0.f, 0.f, true );
+ mImpl->mScrollPosition.y = 0.f;
break;
}
- case Toolkit::TextSelectionPopup::CLIPBOARD:
+ case LayoutEngine::VERTICAL_ALIGN_CENTER:
{
- mImpl->ShowClipboard();
+ mImpl->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
break;
}
- case Toolkit::TextSelectionPopup::NONE:
+ case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
{
- // Nothing to do.
+ mImpl->mScrollPosition.y = controlSize.height - layoutSize.height;
break;
}
}
}
-ImfManager::ImfCallbackData Controller::OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent )
+// private : Events.
+
+void Controller::ProcessModifyEvents()
{
- // Whether the text needs to be relaid-out.
- bool requestRelayout = false;
+ Vector<ModifyEvent>& events = mImpl->mModifyEvents;
- // Whether to retrieve the text and cursor position to be sent to the IMF manager.
- bool retrieveText = false;
- bool retrieveCursor = false;
+ if( 0u == events.Count() )
+ {
+ // Nothing to do.
+ return;
+ }
- switch( imfEvent.eventName )
+ for( Vector<ModifyEvent>::ConstIterator it = events.Begin(),
+ endIt = events.End();
+ it != endIt;
+ ++it )
{
- case ImfManager::COMMIT:
+ const ModifyEvent& event = *it;
+
+ if( ModifyEvent::TEXT_REPLACED == event.type )
{
- InsertText( imfEvent.predictiveString, Text::Controller::COMMIT );
- requestRelayout = true;
- retrieveCursor = true;
- break;
+ // A (single) replace event should come first, otherwise we wasted time processing NOOP events
+ DALI_ASSERT_DEBUG( it == events.Begin() && "Unexpected TEXT_REPLACED event" );
+
+ TextReplacedEvent();
}
- case ImfManager::PREEDIT:
+ else if( ModifyEvent::TEXT_INSERTED == event.type )
{
- InsertText( imfEvent.predictiveString, Text::Controller::PRE_EDIT );
- requestRelayout = true;
- retrieveCursor = true;
- break;
+ TextInsertedEvent();
}
- case ImfManager::DELETESURROUNDING:
+ else if( ModifyEvent::TEXT_DELETED == event.type )
{
- const bool textDeleted = RemoveText( imfEvent.cursorOffset,
- imfEvent.numberOfChars,
- DONT_UPDATE_INPUT_STYLE );
-
- if( textDeleted )
+ // Placeholder-text cannot be deleted
+ if( !mImpl->IsShowingPlaceholderText() )
{
- if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
- !mImpl->IsPlaceholderAvailable() )
- {
- mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
- }
- else
- {
- ShowPlaceholderText();
- }
- mImpl->mEventData->mUpdateCursorPosition = true;
- mImpl->mEventData->mScrollAfterDelete = true;
-
- requestRelayout = true;
+ TextDeletedEvent();
}
- break;
- }
- case ImfManager::GETSURROUNDING:
- {
- retrieveText = true;
- retrieveCursor = true;
- break;
- }
- case ImfManager::VOID:
- {
- // do nothing
- break;
}
- } // end switch
+ }
- if( requestRelayout )
+ if( NULL != mImpl->mEventData )
{
- mImpl->mOperationsPending = ALL_OPERATIONS;
- mImpl->RequestRelayout();
-
- // Do this last since it provides callbacks into application code
- mImpl->mControlInterface.TextChanged();
+ // When the text is being modified, delay cursor blinking
+ mImpl->mEventData->mDecorator->DelayCursorBlink();
}
- std::string text;
- CharacterIndex cursorPosition = 0u;
- Length numberOfWhiteSpaces = 0u;
+ // Discard temporary text
+ events.Clear();
+}
- if( retrieveCursor )
- {
- numberOfWhiteSpaces = mImpl->GetNumberOfWhiteSpaces( 0u );
+void Controller::TextReplacedEvent()
+{
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
- cursorPosition = mImpl->GetLogicalCursorPosition();
+ // Apply modifications to the model
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+}
- if( cursorPosition < numberOfWhiteSpaces )
- {
- cursorPosition = 0u;
- }
- else
- {
- cursorPosition -= numberOfWhiteSpaces;
- }
+void Controller::TextInsertedEvent()
+{
+ DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextInsertedEvent" );
+
+ if( NULL == mImpl->mEventData )
+ {
+ return;
}
- if( retrieveText )
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
+
+ // Apply modifications to the model; TODO - Optimize this
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+}
+
+void Controller::TextDeletedEvent()
+{
+ DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected TextDeletedEvent" );
+
+ if( NULL == mImpl->mEventData )
{
- mImpl->GetText( numberOfWhiteSpaces, text );
+ return;
}
- ImfManager::ImfCallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false );
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
- return callbackData;
+ // Apply modifications to the model; TODO - Optimize this
+ mImpl->mOperationsPending = ALL_OPERATIONS;
}
-Controller::~Controller()
+void Controller::SelectEvent( float x, float y, bool selectAll )
{
- delete mImpl;
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SelectEvent\n" );
+
+ if( NULL != mImpl->mEventData )
+ {
+ if( selectAll )
+ {
+ Event event( Event::SELECT_ALL );
+ mImpl->mEventData->mEventQueue.push_back( event );
+ }
+ else
+ {
+ Event event( Event::SELECT );
+ event.p2.mFloat = x;
+ event.p3.mFloat = y;
+ mImpl->mEventData->mEventQueue.push_back( event );
+ }
+
+ mImpl->RequestRelayout();
+ }
}
bool Controller::BackspaceKeyEvent()
return removed;
}
+// private : Helpers.
+
+void Controller::ResetText()
+{
+ // Reset buffers.
+ mImpl->mLogicalModel->mText.Clear();
+
+ // We have cleared everything including the placeholder-text
+ mImpl->PlaceholderCleared();
+
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0u;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = 0u;
+
+ // Clear any previous text.
+ mImpl->mTextUpdateInfo.mClearAll = true;
+
+ // The natural size needs to be re-calculated.
+ mImpl->mRecalculateNaturalSize = true;
+
+ // Apply modifications to the model
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+}
+
void Controller::ShowPlaceholderText()
{
if( mImpl->IsPlaceholderAvailable() )
mImpl->mLogicalModel->ClearFontDescriptionRuns();
}
+void Controller::ResetCursorPosition( CharacterIndex cursorIndex )
+{
+ // Reset the cursor position
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mPrimaryCursorPosition = cursorIndex;
+
+ // Update the cursor if it's in editing mode.
+ if( EventData::IsEditingState( mImpl->mEventData->mState ) )
+ {
+ mImpl->mEventData->mUpdateCursorPosition = true;
+ }
+ }
+}
+
+void Controller::ResetScrollPosition()
+{
+ if( NULL != mImpl->mEventData )
+ {
+ // Reset the scroll position.
+ mImpl->mScrollPosition = Vector2::ZERO;
+ mImpl->mEventData->mScrollAfterUpdatePosition = true;
+ }
+}
+
+// private : Private contructors & copy operator.
+
Controller::Controller( ControlInterface& controlInterface )
: mImpl( NULL )
{
mImpl = new Controller::Impl( controlInterface );
}
+// The copy constructor and operator are left unimplemented.
+
+// protected : Destructor.
+
+Controller::~Controller()
+{
+ delete mImpl;
+}
+
} // namespace Text
} // namespace Toolkit
#define __DALI_TOOLKIT_TEXT_CONTROLLER_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.
typedef IntrusivePtr<Controller> ControllerPtr;
typedef Dali::Toolkit::Text::ControlInterface ControlInterface;
-/**
- * @brief Different placeholder-text can be shown when the control is active/inactive.
- */
-enum PlaceholderType
-{
- PLACEHOLDER_TYPE_ACTIVE,
- PLACEHOLDER_TYPE_INACTIVE,
-};
-
/**
* @brief A Text Controller is used by UI Controls which display text.
*
*/
class Controller : public RefObject, public Decorator::ControllerInterface, public TextSelectionPopupCallbackInterface
{
-public:
+public: // Enumerated types.
/**
* @brief Text related operations to be done in the relayout process.
DONT_UPDATE_INPUT_STYLE
};
+ /**
+ * @brief Used to specify what has been updated after the Relayout() method has been called.
+ */
enum UpdateTextType
{
- NONE_UPDATED = 0x0,
- MODEL_UPDATED = 0x1,
- DECORATOR_UPDATED = 0x2
+ NONE_UPDATED = 0x0, ///< Nothing has been updated.
+ MODEL_UPDATED = 0x1, ///< The text's model has been updated.
+ DECORATOR_UPDATED = 0x2 ///< The decoration has been updated.
};
+ /**
+ * @brief Different placeholder-text can be shown when the control is active/inactive.
+ */
+ enum PlaceholderType
+ {
+ PLACEHOLDER_TYPE_ACTIVE,
+ PLACEHOLDER_TYPE_INACTIVE,
+ };
+
+public: // Constructor.
+
/**
* @brief Create a new instance of a Controller.
*
*/
static ControllerPtr New( ControlInterface& controlInterface );
+public: // Configure the text controller.
+
/**
* @brief Called to enable text input.
*
*/
bool IsSmoothHandlePanEnabled() const;
+ /**
+ * @brief Sets the maximum number of characters that can be inserted into the TextModel
+ *
+ * @param[in] maxCharacters maximum number of characters to be accepted
+ */
+ void SetMaximumNumberOfCharacters( Length maxCharacters );
+
+ /**
+ * @brief Sets the maximum number of characters that can be inserted into the TextModel
+ *
+ * @param[in] maxCharacters maximum number of characters to be accepted
+ */
+ int GetMaximumNumberOfCharacters();
+
+ /**
+ * @brief Called to enable/disable cursor blink.
+ *
+ * @note Only editable controls should calls this.
+ * @param[in] enabled Whether the cursor should blink or not.
+ */
+ void SetEnableCursorBlink( bool enable );
+
+ /**
+ * @brief Query whether cursor blink is enabled.
+ *
+ * @return Whether the cursor should blink or not.
+ */
+ bool GetEnableCursorBlink() const;
+
+ /**
+ * @brief Whether to enable the multi-line layout.
+ *
+ * @param[in] enable \e true enables the multi-line (by default)
+ */
+ void SetMultiLineEnabled( bool enable );
+
+ /**
+ * @return Whether the multi-line layout is enabled.
+ */
+ bool IsMultiLineEnabled() const;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::SetHorizontalAlignment()
+ */
+ void SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::GetHorizontalAlignment()
+ */
+ LayoutEngine::HorizontalAlignment GetHorizontalAlignment() const;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::SetVerticalAlignment()
+ */
+ void SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment );
+
+ /**
+ * @copydoc Dali::Toolkit::Text::LayoutEngine::GetVerticalAlignment()
+ */
+ LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
+
+public: // Update.
+
/**
* @brief Replaces any text previously set.
*
*/
void GetText( std::string& text ) const;
- /**
- * @brief Remove a given number of characters
- *
- * When predictve text is used the pre-edit text is removed and inserted again with the new characters.
- * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input
- * style when pre-edit text is removed.
- *
- * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
- * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset.
- * @param[in] type Whether to update the input style.
- * @return True if the remove was successful.
- */
- bool RemoveText( int cursorOffset,
- int numberOfCharacters,
- UpdateInputStyleType type );
-
/**
* @brief Replaces any placeholder text previously set.
*
void GetPlaceholderText( PlaceholderType type, std::string& text ) const;
/**
- * @brief Sets the maximum number of characters that can be inserted into the TextModel
- *
- * @param[in] maxCharacters maximum number of characters to be accepted
+ * @ brief Update the text after a font change
+ * @param[in] newDefaultFont The new font to change to
*/
- void SetMaximumNumberOfCharacters( Length maxCharacters );
+ void UpdateAfterFontChange( const std::string& newDefaultFont );
- /**
- * @brief Sets the maximum number of characters that can be inserted into the TextModel
- *
- * @param[in] maxCharacters maximum number of characters to be accepted
- */
- int GetMaximumNumberOfCharacters();
+public: // Default style & Input style
/**
* @brief Set the default font family.
*/
const std::string& GetDefaultFontFamily() const;
- /**
- * @brief Sets the font's style string.
- *
- * @note The style set may be changed by the underlying font system. The string is stored to be recovered.
- *
- * @param[in] style The font's style string.
- */
- void SetDefaultFontStyle( const std::string& style );
-
- /**
- * @brief Retrieves the font's style.
- *
- * @return The font's style.
- */
- const std::string& GetDefaultFontStyle() const;
-
/**
* @brief Sets the default font weight.
*
*/
void SetDefaultFontWeight( FontWeight weight );
+ /**
+ * @brief Whether the font's weight has been defined.
+ */
+ bool IsDefaultFontWeightDefined() const;
+
/**
* @brief Retrieves the default font weight.
*
*/
void SetDefaultFontWidth( FontWidth width );
+ /**
+ * @brief Whether the font's width has been defined.
+ */
+ bool IsDefaultFontWidthDefined() const;
+
/**
* @brief Retrieves the default font width.
*
*/
void SetDefaultFontSlant( FontSlant slant );
+ /**
+ * @brief Whether the font's slant has been defined.
+ */
+ bool IsDefaultFontSlantDefined() const;
+
/**
* @brief Retrieves the default font slant.
*
*/
float GetDefaultPointSize() const;
- /**
- * @ brief Update the text after a font change
- * @param[in] newDefaultFont The new font to change to
- */
- void UpdateAfterFontChange( const std::string& newDefaultFont );
-
/**
* @brief Set the text color
*
*/
const std::string& GetInputFontFamily() const;
- /**
- * @brief Sets the input text's font style.
- *
- * @param[in] fontStyle The input text's font style.
- */
- void SetInputFontStyle( const std::string& fontStyle );
-
- /**
- * @brief Retrieves the input text's font style.
- *
- * @return The input text's font style.
- */
- const std::string& GetInputFontStyle() const;
-
/**
* @brief Sets the input font's weight.
*
*/
void SetInputFontWeight( FontWeight weight );
+ /**
+ * @return Whether the font's weight has been defined.
+ */
+ bool IsInputFontWeightDefined() const;
+
/**
* @brief Retrieves the input font's weight.
*
*/
void SetInputFontWidth( FontWidth width );
+ /**
+ * @return Whether the font's width has been defined.
+ */
+ bool IsInputFontWidthDefined() const;
+
/**
* @brief Retrieves the input font's width.
*
*/
void SetInputFontSlant( FontSlant slant );
+ /**
+ * @return Whether the font's slant has been defined.
+ */
+ bool IsInputFontSlantDefined() const;
+
/**
* @brief Retrieves the input font's slant.
*
*/
const std::string& GetInputOutlineProperties() const;
+public: // Queries & retrieves.
+
/**
- * @brief Called to enable/disable cursor blink.
+ * @brief Return the layout engine.
*
- * @note Only editable controls should calls this.
- * @param[in] enabled Whether the cursor should blink or not.
+ * @return A reference to the layout engine.
*/
- void SetEnableCursorBlink( bool enable );
+ LayoutEngine& GetLayoutEngine();
/**
- * @brief Query whether cursor blink is enabled.
+ * @brief Return a view of the text.
*
- * @return Whether the cursor should blink or not.
+ * @return A reference to the view.
*/
- bool GetEnableCursorBlink() const;
+ View& GetView();
/**
* @brief Query the current scroll position; the UI control is responsible for moving actors to this position.
*/
float GetHeightForWidth( float width );
+public: // Relayout.
+
/**
* @brief Triggers a relayout which updates View (if necessary).
*
*/
UpdateTextType Relayout( const Size& size );
- /**
- * @brief Process queued events which modify the model.
- */
- void ProcessModifyEvents();
+public: // Input style change signals.
/**
- * @brief Used to remove placeholder text.
+ * @return Whether the queue of input style changed signals is empty.
*/
- void ResetText();
+ bool IsInputStyleChangedSignalsQueueEmpty();
/**
- * @brief Used to reset the cursor position after setting a new text.
+ * @brief Process all pending input style changed signals.
*
- * @param[in] cursorIndex Where to place the cursor.
+ * Calls the Text::ControlInterface::InputStyleChanged() method which is overriden by the
+ * text controls. Text controls may send signals to state the input style has changed.
*/
- void ResetCursorPosition( CharacterIndex cursorIndex );
+ void ProcessInputStyleChangedSignals();
+
+public: // Text-input Event Queuing.
/**
- * @brief Used to reset the scroll position after setting a new text.
+ * @brief Called by editable UI controls when keyboard focus is gained.
*/
- void ResetScrollPosition();
+ void KeyboardFocusGainEvent();
/**
- * @brief Used to process an event queued from SetText()
+ * @brief Called by editable UI controls when focus is lost.
*/
- void TextReplacedEvent();
+ void KeyboardFocusLostEvent();
/**
- * @brief Used to process an event queued from key events etc.
+ * @brief Called by editable UI controls when key events are received.
+ *
+ * @param[in] event The key event.
+ * @param[in] type Used to distinguish between regular key events and IMF events.
*/
- void TextInsertedEvent();
+ bool KeyEvent( const Dali::KeyEvent& event );
/**
- * @brief Used to process an event queued from backspace key etc.
+ * @brief Called by editable UI controls when a tap gesture occurs.
+ * @param[in] tapCount The number of taps.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
*/
- void TextDeletedEvent();
+ void TapEvent( unsigned int tapCount, float x, float y );
/**
- * @brief Lays-out the text.
- *
- * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method.
+ * @brief Called by editable UI controls when a pan gesture occurs.
*
- * @param[in] size A the size of a bounding box to layout text within.
- * @param[in] operations The layout operations which need to be done.
- * @param[out] layoutSize The size of the laid-out text.
+ * @param[in] state The state of the gesture.
+ * @param[in] displacement This distance panned since the last pan gesture.
*/
- bool DoRelayout( const Size& size,
- OperationsMask operations,
- Size& layoutSize );
+ void PanEvent( Gesture::State state, const Vector2& displacement );
/**
- * @brief Whether to enable the multi-line layout.
+ * @brief Called by editable UI controls when a long press gesture occurs.
*
- * @param[in] enable \e true enables the multi-line (by default)
+ * @param[in] state The state of the gesture.
+ * @param[in] x The x position relative to the top-left of the parent control.
+ * @param[in] y The y position relative to the top-left of the parent control.
*/
- void SetMultiLineEnabled( bool enable );
+ void LongPressEvent( Gesture::State state, float x, float y );
/**
- * @return Whether the multi-line layout is enabled.
+ * @brief Event received from IMF manager
+ *
+ * @param[in] imfManager The IMF manager.
+ * @param[in] imfEvent The event received.
+ * @return A data struture indicating if update is needed, cursor position and current text.
*/
- bool IsMultiLineEnabled() const;
+ ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::SetHorizontalAlignment()
+ * @brief Event from Clipboard notifying an Item has been selected for pasting
*/
- void SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment );
+ void PasteClipboardItemEvent();
+
+protected: // Inherit from Text::Decorator::ControllerInterface.
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::GetHorizontalAlignment()
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
*/
- LayoutEngine::HorizontalAlignment GetHorizontalAlignment() const;
+ virtual void GetTargetSize( Vector2& targetSize );
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::SetVerticalAlignment()
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
*/
- void SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment );
+ virtual void AddDecoration( Actor& actor, bool needsClipping );
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::GetVerticalAlignment()
+ * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
*/
- LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
+ virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
+
+protected: // Inherit from TextSelectionPopup::TextPopupButtonCallbackInterface.
/**
- * @brief Calulates the vertical offset to align the text inside the bounding box.
- *
- * @param[in] size The size of the bounding box.
+ * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
*/
- void CalculateVerticalOffset( const Size& size );
+ virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
+
+private: // Update.
/**
- * @brief Return the layout engine.
+ * @brief Called by editable UI controls when key events are received.
*
- * @return A reference to the layout engine.
+ * @param[in] text The text to insert.
+ * @param[in] type Used to distinguish between regular key events and IMF events.
*/
- LayoutEngine& GetLayoutEngine();
+ void InsertText( const std::string& text, InsertType type );
/**
- * @brief Return a view of the text.
- *
- * @return A reference to the view.
+ * @brief Paste given string into Text model
+ * @param[in] stringToPaste this string will be inserted into the text model
*/
- View& GetView();
-
- // Text-input Event Queuing
+ void PasteText( const std::string& stringToPaste );
/**
- * @brief Called by editable UI controls when keyboard focus is gained.
+ * @brief Remove a given number of characters
+ *
+ * When predictve text is used the pre-edit text is removed and inserted again with the new characters.
+ * The UpdateInputStyleType @type parameter if set to DONT_UPDATE_INPUT_STYLE avoids to update the input
+ * style when pre-edit text is removed.
+ *
+ * @param[in] cursorOffset Start position from the current cursor position to start deleting characters.
+ * @param[in] numberOfCharacters The number of characters to delete from the cursorOffset.
+ * @param[in] type Whether to update the input style.
+ * @return True if the remove was successful.
*/
- void KeyboardFocusGainEvent();
+ bool RemoveText( int cursorOffset,
+ int numberOfCharacters,
+ UpdateInputStyleType type );
/**
- * @brief Called by editable UI controls when focus is lost.
+ * @brief Checks if text is selected and if so removes it.
+ * @return true if text was removed
*/
- void KeyboardFocusLostEvent();
+ bool RemoveSelectedText();
+
+private: // Relayout.
/**
- * @brief Called by editable UI controls when key events are received.
+ * @brief Lays-out the text.
*
- * @param[in] event The key event.
- * @param[in] type Used to distinguish between regular key events and IMF events.
+ * GetNaturalSize(), GetHeightForWidth() and Relayout() calls this method.
+ *
+ * @param[in] size A the size of a bounding box to layout text within.
+ * @param[in] operations The layout operations which need to be done.
+ * @param[out] layoutSize The size of the laid-out text.
*/
- bool KeyEvent( const Dali::KeyEvent& event );
+ bool DoRelayout( const Size& size,
+ OperationsMask operations,
+ Size& layoutSize );
/**
- * @brief Called by editable UI controls when key events are received.
+ * @brief Calulates the vertical offset to align the text inside the bounding box.
*
- * @param[in] text The text to insert.
- * @param[in] type Used to distinguish between regular key events and IMF events.
+ * @param[in] size The size of the bounding box.
*/
- void InsertText( const std::string& text, InsertType type );
+ void CalculateVerticalOffset( const Size& size );
+
+private: // Events.
/**
- * @brief Checks if text is selected and if so removes it.
- * @return true if text was removed
+ * @brief Process queued events which modify the model.
*/
- bool RemoveSelectedText();
+ void ProcessModifyEvents();
/**
- * @brief Called by editable UI controls when a tap gesture occurs.
- * @param[in] tapCount The number of taps.
- * @param[in] x The x position relative to the top-left of the parent control.
- * @param[in] y The y position relative to the top-left of the parent control.
+ * @brief Used to process an event queued from SetText()
*/
- void TapEvent( unsigned int tapCount, float x, float y );
+ void TextReplacedEvent();
/**
- * @brief Called by editable UI controls when a pan gesture occurs.
- *
- * @param[in] state The state of the gesture.
- * @param[in] displacement This distance panned since the last pan gesture.
+ * @brief Used to process an event queued from key events etc.
*/
- void PanEvent( Gesture::State state, const Vector2& displacement );
+ void TextInsertedEvent();
/**
- * @brief Called by editable UI controls when a long press gesture occurs.
- *
- * @param[in] state The state of the gesture.
- * @param[in] x The x position relative to the top-left of the parent control.
- * @param[in] y The y position relative to the top-left of the parent control.
+ * @brief Used to process an event queued from backspace key etc.
*/
- void LongPressEvent( Gesture::State state, float x, float y );
+ void TextDeletedEvent();
/**
* @brief Creates a selection event.
void SelectEvent( float x, float y, bool selectAll );
/**
- * @brief Event received from IMF manager
+ * @brief Helper to KeyEvent() to handle the backspace case.
*
- * @param[in] imfManager The IMF manager.
- * @param[in] imfEvent The event received.
- * @return A data struture indicating if update is needed, cursor position and current text.
- */
- ImfManager::ImfCallbackData OnImfEvent( ImfManager& imfManager, const ImfManager::ImfEventData& imfEvent );
-
- /**
- * @brief Paste given string into Text model
- * @param[in] stringToPaste this string will be inserted into the text model
- */
- void PasteText( const std::string& stringToPaste );
-
- /**
- * @brief Event from Clipboard notifying an Item has been selected for pasting
+ * @return True if a character was deleted.
*/
- void PasteClipboardItemEvent();
+ bool BackspaceKeyEvent();
- /**
- * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::GetTargetSize()
- */
- virtual void GetTargetSize( Vector2& targetSize );
+private: // Helpers.
/**
- * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
+ * @brief Used to remove the text included the placeholder text.
*/
- virtual void AddDecoration( Actor& actor, bool needsClipping );
+ void ResetText();
/**
- * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()
+ * @brief Helper to show the place holder text..
*/
- virtual void DecorationEvent( HandleType handle, HandleState state, float x, float y );
+ void ShowPlaceholderText();
/**
- * @copydoc Dali::Toolkit::TextSelectionPopup::TextPopupButtonCallbackInterface::TextPopupButtonTouched()
+ * @brief Helper to clear font-specific data (only).
*/
- virtual void TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button );
-
-protected:
+ void ClearFontData();
/**
- * @brief A reference counted object may only be deleted by calling Unreference().
+ * @brief Helper to clear text's style data.
*/
- virtual ~Controller();
-
-private:
+ void ClearStyleData();
/**
- * @brief Helper to KeyEvent() to handle the backspace case.
+ * @brief Used to reset the cursor position after setting a new text.
*
- * @return True if a character was deleted.
- */
- bool BackspaceKeyEvent();
-
- /**
- * @brief Helper to clear font-specific data.
+ * @param[in] cursorIndex Where to place the cursor.
*/
- void ShowPlaceholderText();
+ void ResetCursorPosition( CharacterIndex cursorIndex );
/**
- * @brief Helper to clear font-specific data (only).
+ * @brief Used to reset the scroll position after setting a new text.
*/
- void ClearFontData();
+ void ResetScrollPosition();
- /**
- * @brief Helper to clear text's style data.
- */
- void ClearStyleData();
+private: // Private contructors & copy operator.
/**
* @brief Private constructor.
// Undefined
Controller& operator=( const Controller& handle );
+protected: // Destructor.
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~Controller();
+
private:
struct Impl;
const std::string style = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "Text Control %p FONT_STYLE %s\n", controller.Get(), style.c_str() );
- switch( type )
- {
- case FontStyle::DEFAULT:
- {
- // Stores the default font's style string to be recovered by the GetFontStyleProperty() function.
- controller->SetDefaultFontStyle( style );
- break;
- }
- case FontStyle::INPUT:
- {
- // Stores the input font's style string to be recovered by the GetFontStyleProperty() function.
- controller->SetInputFontStyle( style );
- break;
- }
- }
-
// Parses and applies the style.
Property::Map map;
ParsePropertyString( style, map );
/// Weight key
Property::Value* weightValue = map.Find( WEIGHT_KEY );
- FontWeight weight = TextAbstraction::FontWeight::NORMAL;
+ FontWeight weight = TextAbstraction::FontWeight::NONE;
const bool weightDefined = weightValue != NULL;
if( weightDefined )
{
/// Width key
Property::Value* widthValue = map.Find( WIDTH_KEY );
- FontWidth width = TextAbstraction::FontWidth::NORMAL;
+ FontWidth width = TextAbstraction::FontWidth::NONE;
const bool widthDefined = widthValue != NULL;
if( widthDefined )
{
/// Slant key
Property::Value* slantValue = map.Find( SLANT_KEY );
- FontSlant slant = TextAbstraction::FontSlant::NORMAL;
+ FontSlant slant = TextAbstraction::FontSlant::NONE;
const bool slantDefined = slantValue != NULL;
if( slantDefined )
{
case FontStyle::DEFAULT:
{
// Sets the default font's style values.
- if( weightDefined && ( controller->GetDefaultFontWeight() != weight ) )
+ if( !weightDefined ||
+ ( weightDefined && ( controller->GetDefaultFontWeight() != weight ) ) )
{
controller->SetDefaultFontWeight( weight );
}
- if( widthDefined && ( controller->GetDefaultFontWidth() != width ) )
+ if( !widthDefined ||
+ ( widthDefined && ( controller->GetDefaultFontWidth() != width ) ) )
{
controller->SetDefaultFontWidth( width );
}
- if( slantDefined && ( controller->GetDefaultFontSlant() != slant ) )
+ if( !slantDefined ||
+ ( slantDefined && ( controller->GetDefaultFontSlant() != slant ) ) )
{
controller->SetDefaultFontSlant( slant );
}
case FontStyle::INPUT:
{
// Sets the input font's style values.
- if( weightDefined && ( controller->GetInputFontWeight() != weight ) )
+ if( !weightDefined ||
+ ( weightDefined && ( controller->GetInputFontWeight() != weight ) ) )
{
controller->SetInputFontWeight( weight );
}
- if( widthDefined && ( controller->GetInputFontWidth() != width ) )
+ if( !widthDefined ||
+ ( widthDefined && ( controller->GetInputFontWidth() != width ) ) )
{
controller->SetInputFontWidth( width );
}
- if( slantDefined && ( controller->GetInputFontSlant() != slant ) )
+ if( !slantDefined ||
+ ( slantDefined && ( controller->GetInputFontSlant() != slant ) ) )
{
controller->SetInputFontSlant( slant );
}
break;
}
- }
- }
- }
+ } // switch
+ } // map not empty
+ else
+ {
+ switch( type )
+ {
+ case FontStyle::DEFAULT:
+ {
+ controller->SetDefaultFontWeight( TextAbstraction::FontWeight::NONE );
+ controller->SetDefaultFontWidth( TextAbstraction::FontWidth::NONE );
+ controller->SetDefaultFontSlant( TextAbstraction::FontSlant::NONE );
+ break;
+ }
+ case FontStyle::INPUT:
+ {
+ controller->SetInputFontWeight( TextAbstraction::FontWeight::NONE );
+ controller->SetInputFontWidth( TextAbstraction::FontWidth::NONE );
+ controller->SetInputFontSlant( TextAbstraction::FontSlant::NONE );
+ break;
+ }
+ } // switch
+ } // map.Empty()
+ } // controller
}
void GetFontStyleProperty( ControllerPtr controller, Property::Value& value, FontStyle::Type type )
{
if( controller )
{
- switch( type )
+ const bool isDefaultStyle = FontStyle::DEFAULT == type;
+
+ bool weightDefined = false;
+ bool widthDefined = false;
+ bool slantDefined = false;
+ FontWeight weight = TextAbstraction::FontWeight::NONE;
+ FontWidth width = TextAbstraction::FontWidth::NONE;
+ FontSlant slant = TextAbstraction::FontSlant::NONE;
+
+ if( isDefaultStyle )
+ {
+ weightDefined = controller->IsDefaultFontWeightDefined();
+ widthDefined = controller->IsDefaultFontWidthDefined();
+ slantDefined = controller->IsDefaultFontSlantDefined();
+
+ if( weightDefined )
+ {
+ weight = controller->GetDefaultFontWeight();
+ }
+
+ if( widthDefined )
+ {
+ width = controller->GetDefaultFontWidth();
+ }
+
+ if( slantDefined )
+ {
+ slant = controller->GetDefaultFontSlant();
+ }
+ }
+ else
+ {
+ weightDefined = controller->IsInputFontWeightDefined();
+ widthDefined = controller->IsInputFontWidthDefined();
+ slantDefined = controller->IsInputFontSlantDefined();
+
+ if( weightDefined )
+ {
+ weight = controller->GetInputFontWeight();
+ }
+
+ if( widthDefined )
+ {
+ width = controller->GetInputFontWidth();
+ }
+
+ if( slantDefined )
+ {
+ slant = controller->GetInputFontSlant();
+ }
+ }
+
+ if( weightDefined || widthDefined || slantDefined )
{
- case FontStyle::DEFAULT:
+ std::string styleString("{");
+ if( weightDefined )
+ {
+ if( TextAbstraction::FontWeight::NONE != weight )
+ {
+ const std::string weightStr( GetEnumerationName( weight,
+ FONT_WEIGHT_STRING_TABLE,
+ FONT_WEIGHT_STRING_TABLE_COUNT ) );
+
+ styleString += "\"weight\":\"" + weightStr + "\"";
+ }
+ else
+ {
+ weightDefined = false;
+ }
+ }
+
+ if( widthDefined )
+ {
+ if( TextAbstraction::FontWidth::NONE != width )
+ {
+ const std::string widthStr( GetEnumerationName( width,
+ FONT_WIDTH_STRING_TABLE,
+ FONT_WIDTH_STRING_TABLE_COUNT ) );
+
+ if( weightDefined )
+ {
+ styleString += ",";
+ }
+ styleString += "\"width\":\"" + widthStr + "\"";
+ }
+ else
+ {
+ widthDefined = false;
+ }
+ }
+
+ if( slantDefined )
{
- value = controller->GetDefaultFontStyle();
- break;
+ if( TextAbstraction::FontSlant::NONE != slant )
+ {
+ const std::string slantStr( GetEnumerationName( slant,
+ FONT_SLANT_STRING_TABLE,
+ FONT_SLANT_STRING_TABLE_COUNT ) );
+
+ if( weightDefined || widthDefined )
+ {
+ styleString += ",";
+ }
+ styleString += "\"slant\":\"" + slantStr + "\"";
+ }
+ else
+ {
+ slantDefined = false;
+ }
}
- case FontStyle::INPUT:
+
+ if( weightDefined || widthDefined || slantDefined )
{
- value = controller->GetInputFontStyle();
- break;
+ styleString += "}";
}
+ else
+ {
+ styleString.clear();
+ }
+
+ value = styleString;
}
}
}
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters controlSize[%f,%f] offscreenSize[%f,%f] direction[%d] alignmentOffset[%f]\n",
controlSize.x, controlSize.y, offScreenSize.x, offScreenSize.y, direction, alignmentOffset );
- FrameBufferImage offscreenRenderTargetForText = FrameBufferImage::New( offScreenSize.width, offScreenSize.height, Pixel::RGBA8888, Dali::Image::UNUSED );
+ FrameBufferImage offscreenRenderTargetForText = FrameBufferImage::New( offScreenSize.width, offScreenSize.height, Pixel::RGBA8888 );
Renderer renderer;
CreateCameraActor( offScreenSize, mOffscreenCameraActor );
}
}
-void BorderVisual::SetClipRect( const Rect<int>& clipRect )
-{
- Visual::Base::SetClipRect( clipRect );
-
- //ToDo: renderer responds to the clipRect change
-}
-
void BorderVisual::DoSetOnStage( Actor& actor )
{
InitializeRenderer();
- mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( COLOR_NAME, mBorderColor );
+ mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( Toolkit::BorderVisual::Property::COLOR, COLOR_NAME, mBorderColor );
if( mBorderColor.a < 1.f || mAntiAliasing)
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
- mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( SIZE_NAME, mBorderSize );
+ mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( Toolkit::BorderVisual::Property::SIZE, SIZE_NAME, mBorderSize );
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const
*/
virtual ~BorderVisual();
-public: // from Visual
-
- /**
- * @copydoc Visual::SetClipRect
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
/**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
// ToDo: renderer responds to the size change
}
-void ColorVisual::SetClipRect( const Rect<int>& clipRect )
-{
- Visual::Base::SetClipRect( clipRect );
-
- //ToDo: renderer responds to the clipRect change
-}
-
-void ColorVisual::SetOffset( const Vector2& offset )
-{
- //ToDo: renderer applies the offset
-}
-
void ColorVisual::DoSetOnStage( Actor& actor )
{
InitializeRenderer();
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const
mImpl->mRenderer = Renderer::New( geometry, shader );
- mMixColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mMixColor );
+ mMixColorIndex = mImpl->mRenderer.RegisterProperty( Toolkit::ColorVisual::Property::MIX_COLOR, COLOR_NAME, mMixColor );
if( mMixColor.a < 1.f )
{
mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
public: // from Visual
/**
- * @copydoc Visual::SetSize
+ * @copydoc Visual::Base::SetSize
*/
virtual void SetSize( const Vector2& size );
/**
- * @copydoc Visual::SetClipRect
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
- /**
- * @copydoc Visual::SetOffset
- */
- virtual void SetOffset( const Vector2& offset );
-
- /**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-// CLASS HEADER
-#include "debug-visual.h"
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
-#include <dali-toolkit/internal/visuals/visual-string-constants.h>
-#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-namespace
-{
-const char * const POSITION_ATTRIBUTE_NAME("aPosition");
-const char * const INDEX_NAME("indices");
-
-const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
-attribute mediump vec2 aPosition;\n
-uniform mediump mat4 uMvpMatrix;\n
-uniform mediump vec3 uSize;\n
-\n
-void main()\n
-{\n
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vertexPosition.xyz *= uSize;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
-}\n
-);
-
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(\n
-uniform lowp vec4 uColor;\n
-\n
-void main()\n
-{\n
- gl_FragColor = uColor;\n
-}\n
-);
-
-}
-
-
-DebugVisual::DebugVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache )
-{
-}
-
-DebugVisual::~DebugVisual()
-{}
-
-void DebugVisual::DoSetOnStage( Actor& actor )
-{
- InitializeRenderer();
-}
-
-void DebugVisual::DoCreatePropertyMap( Property::Map& map ) const
-{
- map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::DEBUG );
-}
-
-void DebugVisual::InitializeRenderer()
-{
- mImpl->mRenderer = mFactoryCache.GetDebugRenderer();
- if( !mImpl->mRenderer )
- {
- Geometry geometry = CreateQuadWireframeGeometry();
- Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
-
- mImpl->mRenderer = Renderer::New( geometry, shader);
- mFactoryCache.CacheDebugRenderer( mImpl->mRenderer );
- }
-}
-
-Geometry DebugVisual::CreateQuadWireframeGeometry()
-{
- const float halfWidth = 0.5f;
- const float halfHeight = 0.5f;
- struct QuadVertex { Vector2 position;};
- QuadVertex quadVertexData[4] =
- {
- { Vector2(-halfWidth, -halfHeight) },
- { Vector2( halfWidth, -halfHeight) },
- { Vector2( halfWidth, halfHeight) },
- { Vector2(-halfWidth, halfHeight) }
- };
-
- Property::Map quadVertexFormat;
- quadVertexFormat[POSITION_ATTRIBUTE_NAME] = Property::VECTOR2;
- PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
- quadVertices.SetData( quadVertexData, 4 );
-
- // Create indices
- unsigned short indexData[10] = { 0, 1, 1, 2, 2, 3, 3, 0 };
-
- // Create the geometry object
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( quadVertices );
- geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
- geometry.SetType( Geometry::LINES );
-
- return geometry;
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_INTERNAL_DEBUG_VISUAL_H
-#define DALI_TOOLKIT_INTERNAL_DEBUG_VISUAL_H
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-/**
- * The visual which renders a wireframe outline to the control's quad for debugging
- *
- */
-class DebugVisual: public Visual::Base
-{
-public:
-
- /**
- * @brief Constructor.
- *
- * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
- */
- DebugVisual( VisualFactoryCache& factoryCache );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- virtual ~DebugVisual();
-
-protected:
-
- /**
- * @copydoc Visual::DoSetOnStage
- */
- virtual void DoSetOnStage( Actor& actor );
-
- /**
- * @copydoc Visual::CreatePropertyMap
- */
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
-
-
-private:
- /**
- * Create the geometry which presents the quad wireframe.
- * @return The border geometry
- */
- Geometry CreateQuadWireframeGeometry();
-
- /**
- * @brief Initialise the renderer from the cache, if not available, create and save to the cache for sharing.
- */
- void InitializeRenderer();
-
-private:
-
- // Undefined
- DebugVisual( const DebugVisual& debugVisual);
-
- // Undefined
- DebugVisual& operator=( const DebugVisual& debugVisual );
-
-};
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif /* DALI_TOOLKIT_INTERNAL_DEBUG_VISUAL_H */
Visual::Base::SetSize( size );
}
-void GradientVisual::SetClipRect( const Rect<int>& clipRect )
-{
- Visual::Base::SetClipRect( clipRect );
-
- //ToDo: renderer responds to the clipRect change
-}
-
-void GradientVisual::SetOffset( const Vector2& offset )
-{
- //ToDo: renderer applies the offset
-}
-
void GradientVisual::DoSetOnStage( Actor& actor )
{
InitializeRenderer();
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const
public: // from Visual
/**
- * @copydoc Visual::SetSize
+ * @copydoc Visual::Base::SetSize
*/
virtual void SetSize( const Vector2& size );
/**
- * @copydoc Visual::SetClipRect
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
- /**
- * @copydoc Visual::SetOffset
- */
- virtual void SetOffset( const Vector2& offset );
-
- /**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/rendering/texture.h>
#include <dali/public-api/rendering/texture-set.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
#include <dali/public-api/rendering/texture-set.h>
// INTERNAL HEADER
-#include <dali-toolkit/public-api/visuals/batch-image-visual-properties.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
} //unnamed namespace
-BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache, ImageAtlasManager& atlasManager )
+BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
- mAtlasManager( atlasManager ),
mDesiredSize()
{
}
void BatchImageVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
std::string oldImageUrl = mImageUrl;
- Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::BatchImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME );
+ Property::Value* imageURLValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::URL, Dali::Toolkit::Internal::IMAGE_URL_NAME );
if( imageURLValue )
{
imageURLValue->Get( mImageUrl );
int desiredWidth = 0;
- Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::BatchImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
+ Property::Value* desiredWidthValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH, DESIRED_WIDTH );
if( desiredWidthValue )
{
desiredWidthValue->Get( desiredWidth );
}
int desiredHeight = 0;
- Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::BatchImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
+ Property::Value* desiredHeightValue = propertyMap.Find( Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT, DESIRED_HEIGHT );
if( desiredHeightValue )
{
desiredHeightValue->Get( desiredHeight );
naturalSize = Vector2::ZERO;
}
-void BatchImageVisual::SetClipRect( const Rect<int>& clipRect )
-{
- Visual::Base::SetClipRect( clipRect );
-}
-
void BatchImageVisual::InitializeRenderer( const std::string& imageUrl )
{
if( imageUrl.empty() )
{
if( !mImpl->mRenderer )
{
- TextureSet textureSet = mAtlasManager.Add(
+ TextureSet textureSet = mFactoryCache.GetAtlasManager()->Add(
mAtlasRect,
imageUrl,
mDesiredSize );
}
// Turn batching on, to send message it must be on stage
mImpl->mRenderer.SetProperty( Dali::Renderer::Property::BATCHING_ENABLED, true );
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void BatchImageVisual::DoSetOffStage( Actor& actor )
void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::BATCH_IMAGE );
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
- map.Insert( Toolkit::BatchImageVisual::Property::URL, mImageUrl );
- map.Insert( Toolkit::BatchImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
- map.Insert( Toolkit::BatchImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
+ map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
+ map.Insert( Toolkit::ImageVisual::Property::BATCHING_ENABLED, true );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth() );
+ map.Insert( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight() );
}
}
mImpl->mRenderer.Reset();
if( mFactoryCache.CleanRendererCache( url ) )
{
- mAtlasManager.Remove( textureSet, mAtlasRect );
+ mFactoryCache.GetAtlasManager()->Remove( textureSet, mAtlasRect );
}
}
* @brief Constructor.
*
* @param[in] factoryCache The VisualFactoryCache object
- * @param[in] atlasManager The atlasManager object
*/
- BatchImageVisual( VisualFactoryCache& factoryCache, ImageAtlasManager& atlasManager );
+ BatchImageVisual( VisualFactoryCache& factoryCache );
/**
* @brief A reference counted object may only be deleted by calling Unreference().
*/
virtual void GetNaturalSize( Vector2& naturalSize ) const;
- /**
- * @copydoc Visual::Base::SetClipRect
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
private:
- ImageAtlasManager& mAtlasManager;
Vector4 mAtlasRect;
std::string mImageUrl;
Dali::ImageDimensions mDesiredSize;
const char * const IMAGE_SAMPLING_MODE( "samplingMode" );
const char * const IMAGE_DESIRED_WIDTH( "desiredWidth" );
const char * const IMAGE_DESIRED_HEIGHT( "desiredHeight" );
+const char * const IMAGE_WRAP_MODE_U("wrapModeU");
+const char * const IMAGE_WRAP_MODE_V("wrapModeV");
const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
+const char * const BATCHING_ENABLED( "batchingEnabled" );
// fitting modes
DALI_ENUM_TO_STRING_TABLE_BEGIN( FITTING_MODE )
DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::SamplingMode, DONT_CARE )
DALI_ENUM_TO_STRING_TABLE_END( SAMPLING_MODE )
+// wrap modes
+DALI_ENUM_TO_STRING_TABLE_BEGIN( WRAP_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::WrapMode, DEFAULT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::WrapMode, CLAMP_TO_EDGE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::WrapMode, REPEAT )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::WrapMode, MIRRORED_REPEAT )
+DALI_ENUM_TO_STRING_TABLE_END( WRAP_MODE )
+
const std::string PIXEL_AREA_UNIFORM_NAME = "pixelArea";
+const std::string WRAP_MODE_UNIFORM_NAME = "wrapMode";
const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
attribute mediump vec2 aPosition;\n
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
- uniform mediump vec4 uAtlasRect;\n
uniform mediump vec4 pixelArea;
varying mediump vec2 vTexCoord;\n
\n
vertexPosition.xyz *= uSize;\n
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
- vTexCoord = mix( uAtlasRect.xy, uAtlasRect.zw, pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) ) );\n
+ vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
gl_Position = vertexPosition;\n
}\n
);
-const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+const char* FRAGMENT_SHADER_NO_ATLAS = DALI_COMPOSE_SHADER(
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
}\n
);
+const char* FRAGMENT_SHADER_ATLAS_CLAMP = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vTexCoord;\n
+ uniform sampler2D sTexture;\n
+ uniform mediump vec4 uAtlasRect;\n
+ uniform lowp vec4 uColor;\n
+ \n
+ void main()\n
+ {\n
+ mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );\n
+ gl_FragColor = texture2D( sTexture, texCoord ) * uColor;\n
+ }\n
+);
+
+const char* FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vTexCoord;\n
+ uniform sampler2D sTexture;\n
+ uniform mediump vec4 uAtlasRect;\n
+ // WrapMode -- 0: CLAMP; 1: REPEAT; 2: REFLECT;
+ uniform lowp vec2 wrapMode;\n
+ uniform lowp vec4 uColor;\n
+ \n
+ mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )\n
+ {\n
+ mediump float coord;\n
+ if( wrap > 1.5 )\n // REFLECT
+ coord = 1.0-abs(fract(coordinate*0.5)*2.0 - 1.0);\n
+ else \n// warp == 0 or 1
+ coord = mix(coordinate, fract( coordinate ), wrap);\n
+ return clamp( mix(range.x, range.y, coord), range.x, range.y );
+ }\n
+ \n
+ void main()\n
+ {\n
+ mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),
+ wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );\n
+ gl_FragColor = texture2D( sTexture, texCoord ) * uColor;\n
+ }\n
+);
+
Geometry CreateGeometry( VisualFactoryCache& factoryCache, ImageDimensions gridSize )
{
Geometry geometry;
} //unnamed namespace
-ImageVisual::ImageVisual( VisualFactoryCache& factoryCache, ImageAtlasManager& atlasManager )
+ImageVisual::ImageVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
- mAtlasManager( atlasManager ),
+ mPixelArea( FULL_TEXTURE_RECT ),
mDesiredSize(),
mFittingMode( FittingMode::DEFAULT ),
mSamplingMode( SamplingMode::DEFAULT ),
+ mWrapModeU( WrapMode::DEFAULT ),
+ mWrapModeV( WrapMode::DEFAULT ),
mNativeFragmentShaderCode( ),
mNativeImageFlag( false )
{
desiredHeightValue->Get( desiredHeight );
}
+ Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
+ if( pixelAreaValue )
+ {
+ pixelAreaValue->Get( mPixelArea );
+ }
+
+ Property::Value* wrapModeValueU = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_U, IMAGE_WRAP_MODE_U );
+ if( wrapModeValueU )
+ {
+ Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, mWrapModeU );
+ }
+
+ Property::Value* wrapModeValueV = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_V, IMAGE_WRAP_MODE_V );
+ if( wrapModeValueV )
+ {
+ Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, mWrapModeV );
+ }
+
mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
}
}
}
-void ImageVisual::SetSize( const Vector2& size )
-{
- Visual::Base::SetSize( size );
-}
-
void ImageVisual::GetNaturalSize( Vector2& naturalSize ) const
{
if(mImage)
naturalSize = Vector2::ZERO;
}
-void ImageVisual::SetClipRect( const Rect<int>& clipRect )
-{
- Visual::Base::SetClipRect( clipRect );
-}
-
-void ImageVisual::SetOffset( const Vector2& offset )
-{
-}
-
Renderer ImageVisual::CreateRenderer() const
{
Geometry geometry;
{
geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
- shader = GetImageShader(mFactoryCache);
+ shader = GetImageShader( mFactoryCache,
+ mImpl->mFlags & Impl::IS_ATLASING_APPLIED,
+ mWrapModeU <= WrapMode::CLAMP_TO_EDGE && mWrapModeV <= WrapMode::CLAMP_TO_EDGE );
}
else
{
geometry = CreateGeometry( mFactoryCache, mImpl->mCustomShader->mGridSize );
if( mImpl->mCustomShader->mVertexShader.empty() && mImpl->mCustomShader->mFragmentShader.empty() )
{
- shader = GetImageShader(mFactoryCache);
+ shader = GetImageShader(mFactoryCache, false, true);
}
else
{
shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? VERTEX_SHADER : mImpl->mCustomShader->mVertexShader,
- mImpl->mCustomShader->mFragmentShader.empty() ? FRAGMENT_SHADER : mImpl->mCustomShader->mFragmentShader,
+ mImpl->mCustomShader->mFragmentShader.empty() ? FRAGMENT_SHADER_NO_ATLAS : mImpl->mCustomShader->mFragmentShader,
mImpl->mCustomShader->mHints );
if( mImpl->mCustomShader->mVertexShader.empty() )
{
- shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
}
}
geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
shader = Shader::New( VERTEX_SHADER, mNativeFragmentShaderCode );
- shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
}
else
mImpl->mCustomShader->mHints );
if( mImpl->mCustomShader->mVertexShader.empty() )
{
- shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
}
}
TextureSet textureSet = TextureSet::New();
Renderer renderer = Renderer::New( geometry, shader );
renderer.SetTextures( textureSet );
-
return renderer;
}
if( !mPixels )
{
// use broken image
- return VisualFactory::GetBrokenVisualImage();
+ return VisualFactoryCache::GetBrokenVisualImage();
}
Atlas image = Atlas::New( mPixels.GetWidth(), mPixels.GetHeight(), mPixels.GetPixelFormat() );
image.Upload( mPixels, 0, 0 );
{
// use broken image
textureSet = TextureSet::New();
- TextureSetImage( textureSet, 0u, VisualFactory::GetBrokenVisualImage() );
+ TextureSetImage( textureSet, 0u, VisualFactoryCache::GetBrokenVisualImage() );
}
else
{
- textureSet = mAtlasManager.Add(textureRect, mPixels );
+ textureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, mPixels );
+ mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
if( !textureSet ) // big image, no atlasing
{
+ mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
Atlas image = Atlas::New( mPixels.GetWidth(), mPixels.GetHeight(), mPixels.GetPixelFormat() );
image.Upload( mPixels, 0, 0 );
textureSet = TextureSet::New();
}
else
{
- textureSet = mAtlasManager.Add(textureRect, url, mDesiredSize, mFittingMode, mSamplingMode );
+ textureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, url, mDesiredSize, mFittingMode, mSamplingMode );
+ mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
if( !textureSet ) // big image, no atlasing
{
+ mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
ResourceImage resourceImage = Dali::ResourceImage::New( url, mDesiredSize, mFittingMode, mSamplingMode );
resourceImage.LoadingFinishedSignal().Connect( this, &ImageVisual::OnImageLoaded );
textureSet = TextureSet::New();
}
}
+ if( !(mImpl->mFlags & Impl::IS_ATLASING_APPLIED) )
+ {
+ Sampler sampler = Sampler::New();
+ sampler.SetWrapMode( mWrapModeU, mWrapModeV );
+ textureSet.SetSampler( 0u, sampler );
+ }
+
return textureSet;
}
( strncasecmp( imageUrl.c_str(), HTTP_URL, sizeof(HTTP_URL) -1 ) != 0 ) && // ignore remote images
( strncasecmp( imageUrl.c_str(), HTTPS_URL, sizeof(HTTPS_URL) -1 ) != 0 ) )
{
- mImpl->mRenderer = mFactoryCache.GetRenderer( imageUrl );
- if( !mImpl->mRenderer )
+ bool defaultWrapMode = mWrapModeU <= WrapMode::CLAMP_TO_EDGE && mWrapModeV <= WrapMode::CLAMP_TO_EDGE;
+ bool cacheable = defaultWrapMode && mPixelArea == FULL_TEXTURE_RECT;
+
+ mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
+ if( cacheable ) // fetch the renderer from cache if exist
+ {
+ mImpl->mRenderer = mFactoryCache.GetRenderer( imageUrl );
+ mImpl->mFlags |= Impl::IS_FROM_CACHE;
+ }
+
+ if( !mImpl->mRenderer ) // new renderer is needed
{
Vector4 atlasRect;
TextureSet textureSet = CreateTextureSet(atlasRect, imageUrl, IsSynchronousResourceLoading() );
Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
- Shader shader( GetImageShader(mFactoryCache) );
+ Shader shader( GetImageShader(mFactoryCache, mImpl->mFlags & Impl::IS_ATLASING_APPLIED, defaultWrapMode) );
mImpl->mRenderer = Renderer::New( geometry, shader );
mImpl->mRenderer.SetTextures( textureSet );
- if( atlasRect != FULL_TEXTURE_RECT )
+
+ if( mImpl->mFlags & Impl::IS_ATLASING_APPLIED ) // the texture is packed inside atlas
{
mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
+ if( !defaultWrapMode ) // custom wrap mode, renderer is not cached.
+ {
+ Vector2 wrapMode(mWrapModeU-WrapMode::CLAMP_TO_EDGE, mWrapModeV-WrapMode::CLAMP_TO_EDGE);
+ wrapMode.Clamp( Vector2::ZERO, Vector2( 2.f, 2.f ) );
+ mImpl->mRenderer.RegisterProperty( WRAP_MODE_UNIFORM_NAME, wrapMode );
+ }
}
- mFactoryCache.SaveRenderer( imageUrl, mImpl->mRenderer );
- }
- mImpl->mFlags |= Impl::IS_FROM_CACHE;
+ // save the renderer to cache only when default wrap mode and default pixel area is used
+ if( cacheable )
+ {
+ mFactoryCache.SaveRenderer( imageUrl, mImpl->mRenderer );
+ }
+ }
}
else
{
// for custom shader or remote image, renderer is not cached and atlas is not applied
-
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
mImpl->mRenderer = CreateRenderer();
Image image = LoadImage( imageUrl, IsSynchronousResourceLoading() );
InitializeRenderer( mImage );
}
+ if( mPixelArea != FULL_TEXTURE_RECT )
+ {
+ mImpl->mRenderer.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, mPixelArea );
+ }
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void ImageVisual::DoSetOffStage( Actor& actor )
map.Insert( Toolkit::ImageVisual::Property::FITTING_MODE, mFittingMode );
map.Insert( Toolkit::ImageVisual::Property::SAMPLING_MODE, mSamplingMode );
+
+ map.Insert( Toolkit::ImageVisual::Property::PIXEL_AREA, mPixelArea );
+ map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_U, mWrapModeU );
+ map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
}
-Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache )
+Shader ImageVisual::GetImageShader( VisualFactoryCache& factoryCache, bool atlasing, bool defaultTextureWrapping )
{
- Shader shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER );
- if( !shader )
+ Shader shader;
+ if( atlasing )
{
- shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
- factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER, shader );
- shader.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, FULL_TEXTURE_RECT );
- shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
+ if( defaultTextureWrapping )
+ {
+ shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP );
+ if( !shader )
+ {
+ shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
+ factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader );
+ }
+ }
+ else
+ {
+ shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_CUSTOM_WRAP );
+ if( !shader )
+ {
+ shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_VARIOUS_WRAP );
+ factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_CUSTOM_WRAP, shader );
+ }
+ }
+ }
+ else
+ {
+ shader = factoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER );
+ if( !shader )
+ {
+ shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_NO_ATLAS );
+ factoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER, shader );
+ }
}
+ shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
return shader;
}
mImpl->mRenderer.SetTextures( textureSet );
}
TextureSetImage( textureSet, 0u, image );
+ Sampler sampler = Sampler::New();
+ sampler.SetWrapMode( mWrapModeU, mWrapModeV );
+ textureSet.SetSampler( 0u, sampler );
}
}
{
if( image.GetLoadingState() == Dali::ResourceLoadingFailed )
{
- Image brokenImage = VisualFactory::GetBrokenVisualImage();
+ Image brokenImage = VisualFactoryCache::GetBrokenVisualImage();
if( mImpl->mRenderer )
{
ApplyImageToSampler( brokenImage );
mImpl->mRenderer.Reset();
if( mFactoryCache.CleanRendererCache( url ) && index != Property::INVALID_INDEX )
{
- mAtlasManager.Remove( textureSet, atlasRect );
+ mFactoryCache.GetAtlasManager()->Remove( textureSet, atlasRect );
}
}
}
else
{
- mNativeFragmentShaderCode += FRAGMENT_SHADER;
+ mNativeFragmentShaderCode += FRAGMENT_SHADER_NO_ATLAS;
}
if( customSamplerTypename )
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
// EXTERNAL INCLUDES
#include <dali/public-api/images/image.h>
* @brief Constructor.
*
* @param[in] factoryCache The VisualFactoryCache object
- * @param[in] atlasManager The atlasManager object
*/
- ImageVisual( VisualFactoryCache& factoryCache, ImageAtlasManager& atlasManager );
+ ImageVisual( VisualFactoryCache& factoryCache );
/**
* @brief A reference counted object may only be deleted by calling Unreference().
public: // from Visual
/**
- * @copydoc Visual::SetSize
- */
- virtual void SetSize( const Vector2& size );
-
- /**
- * @copydoc Visual::GetNaturalSize
+ * @copydoc Visual::Base::GetNaturalSize
*/
virtual void GetNaturalSize( Vector2& naturalSize ) const;
/**
- * @copydoc Visual::SetClipRect
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
- /**
- * @copydoc Visual::SetOffset
- */
- virtual void SetOffset( const Vector2& offset );
-
- /**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
/**
- * @copydoc Visual::DoSetOffStage
+ * @copydoc Visual::Base::DoSetOffStage
*/
virtual void DoSetOffStage( Actor& actor );
/**
* Get the standard image rendering shader.
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] atlasing Whether texture atlasing is applied.
+ * @param[in] defaultTextureWrapping Whether the default texture wrap mode is applied.
*/
- static Shader GetImageShader( VisualFactoryCache& factoryCache );
+ static Shader GetImageShader( VisualFactoryCache& factoryCache, bool atlasing, bool defaultTextureWrapping );
/**
* @brief Sets the image of this visual to the resource at imageUrl
private:
Image mImage;
- ImageAtlasManager& mAtlasManager;
PixelData mPixels;
+ Vector4 mPixelArea;
std::string mImageUrl;
Dali::ImageDimensions mDesiredSize;
Dali::FittingMode::Type mFittingMode;
Dali::SamplingMode::Type mSamplingMode;
+ Dali::WrapMode::Type mWrapModeU;
+ Dali::WrapMode::Type mWrapModeV;
std::string mNativeFragmentShaderCode;
bool mNativeImageFlag;
// ToDo: renderer responds to the size change
}
-void MeshVisual::SetClipRect( const Rect<int>& clipRect )
-{
- Visual::Base::SetClipRect( clipRect );
-
- //ToDo: renderer responds to the clipRect change
-}
-
-void MeshVisual::SetOffset( const Vector2& offset )
-{
- //ToDo: renderer applies the offset
-}
-
void MeshVisual::DoSetOnStage( Actor& actor )
{
InitializeRenderer();
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void MeshVisual::DoCreatePropertyMap( Property::Map& map ) const
mImpl->mRenderer = Renderer::New( mGeometry, mShader );
mImpl->mRenderer.SetTextures( mTextureSet );
mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::ON );
}
void MeshVisual::SupplyEmptyGeometry()
public: // from Visual
/**
- * @copydoc Visual::SetSize
+ * @copydoc Visual::Base::SetSize
*/
virtual void SetSize( const Vector2& size );
/**
- * @copydoc Visual::SetClipRect
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
- /**
- * @copydoc Visual::SetOffset
- */
- virtual void SetOffset( const Vector2& offset );
-
- /**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
}
}
-void NPatchVisual::SetClipRect( const Rect<int>& clipRect )
-{
- Visual::Base::SetClipRect( clipRect );
- //ToDo: renderer responds to the clipRect change
-}
-
-void NPatchVisual::SetOffset( const Vector2& offset )
-{
- //ToDo: renderer applies the offset
-}
-
Geometry NPatchVisual::CreateGeometry()
{
Geometry geometry;
{
ApplyImageToSampler();
}
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void NPatchVisual::DoSetOffStage( Actor& actor )
void NPatchVisual::InitializeFromBrokenImage()
{
- mCroppedImage = VisualFactory::GetBrokenVisualImage();
+ mCroppedImage = VisualFactoryCache::GetBrokenVisualImage();
mImageSize = ImageDimensions( mCroppedImage.GetWidth(), mCroppedImage.GetHeight() );
mStretchPixelsX.Clear();
// EXTERNAL INCLUDES
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/image-operations.h>
-#include <dali/public-api/images/nine-patch-image.h>
+#include <dali/devel-api/images/nine-patch-image.h>
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/sampler.h>
#include <dali/public-api/rendering/shader.h>
public: // from Visual
/**
- * @copydoc Visual::GetNaturalSize
+ * @copydoc Visual::Base::GetNaturalSize
*/
virtual void GetNaturalSize( Vector2& naturalSize ) const;
/**
- * @copydoc Visual::SetClipRect
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
- /**
- * @copydoc Visual::SetOffset
- */
- virtual void SetOffset( const Vector2& offset );
-
- /**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
/**
- * @copydoc Visual::DoSetOffStage
+ * @copydoc Visual::Base::DoSetOffStage
*/
virtual void DoSetOffStage( Actor& actor );
//Property names
const char * const PRIMITIVE_SHAPE( "shape" );
-const char * const SHAPE_COLOR( "shapeColor" );
+const char * const SHAPE_COLOR( "mixColor" );
const char * const SLICES( "slices" );
const char * const STACKS( "stacks" );
const char * const SCALE_TOP_RADIUS( "scaleTopRadius" );
const float DEFAULT_SCALE_RADIUS = 1.0; ///< For cylinders
const float DEFAULT_BEVEL_PERCENTAGE = 0.0; ///< For bevelled cubes
const float DEFAULT_BEVEL_SMOOTHNESS = 0.0; ///< For bevelled cubes
-const Vector4 DEFAULT_COLOR = Vector4( 0.5, 0.5, 0.5, 0.0 ); ///< Grey, for all.
+const Vector4 DEFAULT_COLOR = Vector4( 0.5, 0.5, 0.5, 1.0 ); ///< Grey, for all.
//Property limits
-const int MIN_SLICES = 1; ///< Minimum number of slices for spheres and conics
-const int MIN_STACKS = 1; ///< Minimum number of stacks for spheres and conics
+const int MIN_SLICES = 3; ///< Minimum number of slices for spheres and conics
+const int MIN_STACKS = 2; ///< Minimum number of stacks for spheres and conics
const int MAX_PARTITIONS = 255; ///< Maximum number of slices or stacks for spheres and conics
const float MIN_BEVEL_PERCENTAGE = 0.0; ///< Minimum bevel percentage for bevelled cubes
const float MAX_BEVEL_PERCENTAGE = 1.0; ///< Maximum bevel percentage for bevelled cubes
//Shader properties
const char * const OBJECT_MATRIX_UNIFORM_NAME( "uObjectMatrix" );
-const char * const COLOR_UNIFORM_NAME( "uColor" );
+const char * const COLOR_UNIFORM_NAME( "mixColor" );
const char * const OBJECT_DIMENSIONS_UNIFORM_NAME( "uObjectDimensions" );
const char * const STAGE_OFFSET_UNIFORM_NAME( "uStageOffset" );
precision mediump float;\n
varying mediump vec3 vIllumination;\n
uniform lowp vec4 uColor;\n
+ uniform lowp vec4 mixColor;\n
void main()\n
{\n
- gl_FragColor = vec4( vIllumination.rgb * uColor.rgb, uColor.a );\n
+ vec4 baseColor = mixColor * uColor;\n
+ gl_FragColor = vec4( vIllumination.rgb * baseColor.rgb, baseColor.a );\n
}\n
);
//Read in other potential properties.
- Property::Value* color = propertyMap.Find( Toolkit::PrimitiveVisual::Property::COLOR, SHAPE_COLOR );
+ Property::Value* color = propertyMap.Find( Toolkit::PrimitiveVisual::Property::MIX_COLOR, SHAPE_COLOR );
if( color && !color->Get( mColor ) )
{
DALI_LOG_ERROR( "Invalid type for color in PrimitiveVisual.\n" );
if( mSlices > MAX_PARTITIONS )
{
mSlices = MAX_PARTITIONS;
+ DALI_LOG_WARNING( "Value for slices clamped.\n" );
}
else if ( mSlices < MIN_SLICES )
{
mSlices = MIN_SLICES;
+ DALI_LOG_WARNING( "Value for slices clamped.\n" );
}
}
else
if( mStacks > MAX_PARTITIONS )
{
mStacks = MAX_PARTITIONS;
+ DALI_LOG_WARNING( "Value for stacks clamped.\n" );
}
else if ( mStacks < MIN_STACKS )
{
mStacks = MIN_STACKS;
+ DALI_LOG_WARNING( "Value for stacks clamped.\n" );
}
}
else
if( mScaleDimensions.x <= 0.0 )
{
mScaleDimensions.x = 1.0;
+ DALI_LOG_WARNING( "Value for scale dimensions clamped. Must be greater than zero.\n" );
}
if( mScaleDimensions.y <= 0.0 )
{
mScaleDimensions.y = 1.0;
+ DALI_LOG_WARNING( "Value for scale dimensions clamped. Must be greater than zero.\n" );
}
if( mScaleDimensions.z <= 0.0 )
{
mScaleDimensions.z = 1.0;
+ DALI_LOG_WARNING( "Value for scale dimensions clamped. Must be greater than zero.\n" );
}
}
else
if( mBevelPercentage < MIN_BEVEL_PERCENTAGE )
{
mBevelPercentage = MIN_BEVEL_PERCENTAGE;
+ DALI_LOG_WARNING( "Value for bevel percentage clamped.\n" );
}
else if( mBevelPercentage > MAX_BEVEL_PERCENTAGE )
{
mBevelPercentage = MAX_BEVEL_PERCENTAGE;
+ DALI_LOG_WARNING( "Value for bevel percentage clamped.\n" );
}
}
else
if( mBevelSmoothness < MIN_SMOOTHNESS )
{
mBevelSmoothness = MIN_SMOOTHNESS;
+ DALI_LOG_WARNING( "Value for bevel smoothness clamped.\n" );
}
else if( mBevelSmoothness > MAX_SMOOTHNESS )
{
mBevelSmoothness = MAX_SMOOTHNESS;
+ DALI_LOG_WARNING( "Value for bevel smoothness clamped.\n" );
}
}
else
// ToDo: renderer responds to the size change
}
-void PrimitiveVisual::SetClipRect( const Rect<int>& clipRect )
+void PrimitiveVisual::GetNaturalSize( Vector2& naturalSize ) const
{
- Visual::Base::SetClipRect( clipRect );
-
- //ToDo: renderer responds to the clipRect change
-}
-
-void PrimitiveVisual::SetOffset( const Vector2& offset )
-{
- //ToDo: renderer applies the offset
+ naturalSize.x = mObjectDimensions.x;
+ naturalSize.y = mObjectDimensions.y;
}
void PrimitiveVisual::DoSetOnStage( Actor& actor )
{
InitializeRenderer();
+
+ actor.AddRenderer( mImpl->mRenderer );
}
void PrimitiveVisual::DoCreatePropertyMap( Property::Map& map ) const
map.Clear();
map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::PRIMITIVE );
map.Insert( Toolkit::PrimitiveVisual::Property::SHAPE, mPrimitiveType );
- map.Insert( Toolkit::PrimitiveVisual::Property::COLOR, mColor );
+ map.Insert( Toolkit::PrimitiveVisual::Property::MIX_COLOR, mColor );
map.Insert( Toolkit::PrimitiveVisual::Property::SLICES, mSlices );
map.Insert( Toolkit::PrimitiveVisual::Property::STACKS, mStacks );
map.Insert( Toolkit::PrimitiveVisual::Property::SCALE_TOP_RADIUS, mScaleTopRadius );
mShader.RegisterProperty( STAGE_OFFSET_UNIFORM_NAME, Vector2( width, height ) / 2.0f );
mShader.RegisterProperty( LIGHT_POSITION_UNIFORM_NAME, mLightPosition );
mShader.RegisterProperty( OBJECT_MATRIX_UNIFORM_NAME, scaleMatrix );
- mShader.RegisterProperty( COLOR_UNIFORM_NAME, mColor );
+ mShader.RegisterProperty( Toolkit::PrimitiveVisual::Property::MIX_COLOR, COLOR_UNIFORM_NAME, mColor );
mShader.RegisterProperty( OBJECT_DIMENSIONS_UNIFORM_NAME, mObjectDimensions );
}
int normalIndex = 0; //Track progress through normals, as vertices are calculated per face.
float minDimension = std::min( std::min( dimensions.x, dimensions.y ), dimensions.z );
- float bevelScale = 1.0 - bevelPercentage;
- float bevelAmount = 0.5 * bevelScale * minDimension;
+ float bevelAmount = 0.5 * std::min( bevelPercentage, minDimension ); //Cap bevel amount if necessary.
+ //Distances from centre to outer edge points.
float outerX = 0.5 * dimensions.x;
float outerY = 0.5 * dimensions.y;
float outerZ = 0.5 * dimensions.z;
- float bevelX = outerX - ( 0.5 * minDimension - bevelAmount );
- float bevelY = outerY - ( 0.5 * minDimension - bevelAmount );
- float bevelZ = outerZ - ( 0.5 * minDimension - bevelAmount );
+ //Distances from centre to bevelled points.
+ float bevelX = outerX - bevelAmount;
+ float bevelY = outerY - bevelAmount;
+ float bevelZ = outerZ - bevelAmount;
Vector<Vector3> positions; //Holds object points, to be shared between vertexes.
positions.Resize( numPositions );
public: // from Visual
/**
- * @copydoc Visual::SetSize
+ * @copydoc Visual::Base::SetSize
*/
virtual void SetSize( const Vector2& size );
/**
- * @copydoc Visual::SetClipRect
+ * @copydoc Visual::Base::GetNaturalSize
*/
- virtual void SetClipRect( const Rect<int>& clipRect );
+ virtual void GetNaturalSize( Vector2& naturalSize ) const;
/**
- * @copydoc Visual::SetOffset
- */
- virtual void SetOffset( const Vector2& offset );
-
- /**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
#include <dali-toolkit/third-party/nanosvg/nanosvg.h>
#include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
#include <dali-toolkit/internal/visuals/image/image-visual.h>
+#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
namespace Internal
{
-SvgVisual::SvgVisual( VisualFactoryCache& factoryCache, ImageAtlasManager& atlasManager )
+SvgVisual::SvgVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mAtlasRect( FULL_TEXTURE_RECT ),
- mAtlasManager( atlasManager ),
mParsedImage( NULL )
{
// the rasterized image is with pre-multiplied alpha format
}
}
-bool SvgVisual::IsSvgUrl( const std::string& url )
-{
- return url.substr( url.find_last_of(".") + 1 ) == "svg";
-}
-
void SvgVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
void SvgVisual::DoSetOnStage( Actor& actor )
{
- Shader shader = ImageVisual::GetImageShader( mFactoryCache );
+ Shader shader = ImageVisual::GetImageShader( mFactoryCache, true, true );
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
if( !geometry )
{
{
AddRasterizationTask( mImpl->mSize );
}
+
+ // Hold the weak handle of the placement actor and delay the adding of renderer until the svg rasterization is finished.
+ mPlacementActor = actor;
}
void SvgVisual::DoSetOffStage( Actor& actor )
actor.RemoveRenderer( mImpl->mRenderer );
mImpl->mRenderer.Reset();
+ mPlacementActor.Reset();
}
void SvgVisual::GetNaturalSize( Vector2& naturalSize ) const
TextureSet currentTextureSet = mImpl->mRenderer.GetTextures();
if( mAtlasRect != FULL_TEXTURE_RECT )
{
- mAtlasManager.Remove( currentTextureSet, mAtlasRect );
+ mFactoryCache.GetAtlasManager()->Remove( currentTextureSet, mAtlasRect );
}
Vector4 atlasRect;
- TextureSet textureSet = mAtlasManager.Add(atlasRect, rasterizedPixelData );
+ TextureSet textureSet = mFactoryCache.GetAtlasManager()->Add(atlasRect, rasterizedPixelData );
if( textureSet ) // atlasing
{
if( textureSet != currentTextureSet )
}
mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
mAtlasRect = atlasRect;
+ mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
}
else // no atlasing
{
Atlas texture = Atlas::New( rasterizedPixelData.GetWidth(), rasterizedPixelData.GetHeight() );
texture.Upload( rasterizedPixelData, 0, 0 );
+ mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
if( mAtlasRect == FULL_TEXTURE_RECT )
{
TextureSetImage( textureSet, 0u, texture );
}
}
+
+ // Rasterized pixels are uploaded to texture. If weak handle is holding a placement actor, it is the time to add the renderer to actor.
+ Actor actor = mPlacementActor.GetHandle();
+ if( actor )
+ {
+ actor.AddRenderer( mImpl->mRenderer );
+ // reset the weak handle so that the renderer only get added to actor once
+ mPlacementActor.Reset();
+ }
}
}
-
} // namespace Internal
} // namespace Toolkit
*
*/
+//EXTERNAL INCLUDES
+#include <dali/devel-api/object/weak-handle.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
struct NSVGimage;
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
- SvgVisual( VisualFactoryCache& factoryCache, ImageAtlasManager& atlasManager );
+ SvgVisual( VisualFactoryCache& factoryCache );
/**
* @brief A reference counted object may only be deleted by calling Unreference().
public: // from Visual
/**
- * @copydoc Visual::GetNaturalSize
+ * @copydoc Visual::Base::GetNaturalSize
*/
virtual void GetNaturalSize( Vector2& naturalSize ) const;
/**
- * @copydoc Visual::SetSize
+ * @copydoc Visual::Base::SetSize
*/
virtual void SetSize( const Vector2& size );
/**
- * @copydoc Visual::CreatePropertyMap
+ * @copydoc Visual::Base::CreatePropertyMap
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
protected:
/**
- * @copydoc Visual::DoInitialize
+ * @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/**
- * @copydoc Visual::DoSetOnStage
+ * @copydoc Visual::Base::DoSetOnStage
*/
virtual void DoSetOnStage( Actor& actor );
/**
- * @copydoc Visual::DoSetOffStage
+ * @copydoc Visual::Base::DoSetOffStage
*/
virtual void DoSetOffStage( Actor& actor );
public:
- /**
- * @brief Helper method to determine whether the url indicate that it is a svg image.
- *
- * @param [in] url The URL of the image file.
- * @return true if it is a svg image
- */
- static bool IsSvgUrl( const std::string& url );
-
/**
* @brief Sets the svg image of this visual to the resource at imageUrl
* The visual will parse the svg image once it is set.
private:
Vector4 mAtlasRect;
- ImageAtlasManager& mAtlasManager;
std::string mImageUrl;
NSVGimage* mParsedImage;
+ WeakHandle<Actor> mPlacementActor;
};
{
IS_ON_STAGE = 1,
IS_FROM_CACHE = 1 << 1,
- IS_PREMULTIPLIED_ALPHA = 1 << 2,
- IS_SYNCHRONOUS_RESOURCE_LOADING = 1 << 3
+ IS_ATLASING_APPLIED = 1<<2,
+ IS_PREMULTIPLIED_ALPHA = 1 << 3,
+ IS_SYNCHRONOUS_RESOURCE_LOADING = 1 << 4
};
struct CustomShader
CustomShader* mCustomShader;
Vector2 mSize;
- Vector2 mOffset;
float mDepthIndex;
int mFlags;
namespace Internal
{
-namespace Visual
-{
-
-Base::Base( VisualFactoryCache& factoryCache )
+Visual::Base::Base( VisualFactoryCache& factoryCache )
: mImpl( new Impl() ),
mFactoryCache( factoryCache )
{
}
-Base::~Base()
+Visual::Base::~Base()
{
delete mImpl;
}
-void Base::SetCustomShader( const Property::Map& shaderMap )
+void Visual::Base::SetCustomShader( const Property::Map& shaderMap )
{
if( mImpl->mCustomShader )
{
}
}
-void Base::Initialize( Actor& actor, const Property::Map& propertyMap )
+void Visual::Base::Initialize( Actor& actor, const Property::Map& propertyMap )
{
Property::Value* customShaderValue = propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
if( customShaderValue )
DoInitialize( actor, propertyMap );
}
-void Base::SetSize( const Vector2& size )
+void Visual::Base::SetSize( const Vector2& size )
{
mImpl->mSize = size;
}
-const Vector2& Base::GetSize() const
+const Vector2& Visual::Base::GetSize() const
{
return mImpl->mSize;
}
-void Base::GetNaturalSize( Vector2& naturalSize ) const
+void Visual::Base::GetNaturalSize( Vector2& naturalSize ) const
{
naturalSize = Vector2::ZERO;
}
-void Base::SetClipRect( const Rect<int>& clipRect )
-{
-}
-
-void Base::SetOffset( const Vector2& offset )
-{
- mImpl->mOffset = offset;
-}
-
-void Base::SetDepthIndex( float index )
+void Visual::Base::SetDepthIndex( float index )
{
mImpl->mDepthIndex = index;
if( mImpl->mRenderer )
}
}
-float Base::GetDepthIndex() const
+float Visual::Base::GetDepthIndex() const
{
return mImpl->mDepthIndex;
}
-void Base::SetOnStage( Actor& actor )
+void Visual::Base::SetOnStage( Actor& actor )
{
+ // To display the actor correctly, renderer should not be added to actor until all required resources are ready.
+ // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing.
DoSetOnStage( actor );
mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
- actor.AddRenderer( mImpl->mRenderer );
-
mImpl->mFlags |= Impl::IS_ON_STAGE;
}
-void Base::SetOffStage( Actor& actor )
+void Visual::Base::SetOffStage( Actor& actor )
{
if( GetIsOnStage() )
{
}
}
-void Base::EnablePreMultipliedAlpha( bool preMultipled )
+void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled )
{
if(preMultipled)
{
}
}
-bool Base::IsPreMultipliedAlphaEnabled() const
+bool Visual::Base::IsPreMultipliedAlphaEnabled() const
{
return mImpl->mFlags & Impl::IS_PREMULTIPLIED_ALPHA;
}
-void Base::DoSetOnStage( Actor& actor )
-{
-}
-
-void Base::DoSetOffStage( Actor& actor )
+void Visual::Base::DoSetOffStage( Actor& actor )
{
actor.RemoveRenderer( mImpl->mRenderer );
mImpl->mRenderer.Reset();
}
-void Base::CreatePropertyMap( Property::Map& map ) const
+void Visual::Base::CreatePropertyMap( Property::Map& map ) const
{
DoCreatePropertyMap( map );
}
}
-bool Base::GetIsOnStage() const
+bool Visual::Base::GetIsOnStage() const
{
return mImpl->mFlags & Impl::IS_ON_STAGE;
}
-bool Base::GetIsFromCache() const
+bool Visual::Base::GetIsFromCache() const
{
return mImpl->mFlags & Impl::IS_FROM_CACHE;
}
-} // namespace Visual
-
} // namespace Internal
} // namespace Toolkit
*/
virtual void GetNaturalSize( Vector2& naturalSize ) const;
- /**
- * ToDo: Add this function to Toolkit::Visual when it is fully implemented.
- *
- * Set the clip rectangular of this visual.
- * The contents of the visual will not be visible outside this rectangular.
- *
- * @param [in] clipRect The clipping rectangular.
- */
- virtual void SetClipRect( const Rect<int>& clipRect );
-
- /**
- *ToDo: Add this function to Toolkit::Visual when it is fully implemented.
- *
- * Reposition this visual with a 2D offset.
- *
- * @param[in] offset The offset to reposition the visual.
- */
- virtual void SetOffset( const Vector2& offset );
-
/**
* @copydoc Toolkit::Visual::Base::SetDepthIndex
*/
/**
* @brief Called by SetOnStage() allowing sub classes to respond to the SetOnStage event
*
+ * @note The derived class is required to create the renderer, and add it to the actor when all the resources are in place.
+ *
* @param[in] actor The actor applying this visual.
*/
- virtual void DoSetOnStage( Actor& actor );
+ virtual void DoSetOnStage( Actor& actor )=0;
/**
* @brief Called by SetOffStage() allowing sub classes to respond to the SetOffStage event
/*
- * 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.
// EXTERNAL HEADER
#include <dali/devel-api/common/hash.h>
+#include <dali/public-api/images/resource-image.h>
// INTERNAL HEADER
#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dali-toolkit/internal/visuals/svg/svg-visual.h>
+#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
+
+namespace
+{
+const char * const BROKEN_VISUAL_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
+}
namespace Dali
{
return false;
}
-void VisualFactoryCache::CacheDebugRenderer( Renderer& renderer )
+void VisualFactoryCache::CacheWireframeRenderer( Renderer& renderer )
{
- mDebugRenderer = renderer;
+ mWireframeRenderer = renderer;
}
-Renderer VisualFactoryCache::GetDebugRenderer()
+Renderer VisualFactoryCache::GetWireframeRenderer()
{
- return mDebugRenderer;
+ return mWireframeRenderer;
}
Geometry VisualFactoryCache::CreateQuadGeometry()
return geometry;
}
+ImageAtlasManagerPtr VisualFactoryCache::GetAtlasManager()
+{
+ if( !mAtlasManager )
+ {
+ mAtlasManager = new ImageAtlasManager();
+ mAtlasManager->SetBrokenImage( BROKEN_VISUAL_IMAGE_URL );
+ }
+
+ return mAtlasManager;
+}
+
SvgRasterizeThread* VisualFactoryCache::GetSVGRasterizationThread()
{
if( !mSvgRasterizeThread )
return geometry;
}
+Image VisualFactoryCache::GetBrokenVisualImage()
+{
+ return ResourceImage::New( BROKEN_VISUAL_IMAGE_URL );
+}
+
} // namespace Internal
} // namespace Toolkit
namespace Internal
{
+class ImageAtlasManager;
+typedef IntrusivePtr<ImageAtlasManager> ImageAtlasManagerPtr;
+
/**
* Caches shaders and geometries. Owned by VisualFactory.
*/
GRADIENT_SHADER_RADIAL_BOUNDING_BOX,
IMAGE_SHADER,
BATCH_IMAGE_SHADER,
+ IMAGE_SHADER_ATLAS_DEFAULT_WRAP,
+ IMAGE_SHADER_ATLAS_CUSTOM_WRAP,
NINE_PATCH_SHADER,
SVG_SHADER,
SHADER_TYPE_MAX = SVG_SHADER
*/
static Geometry CreateBatchQuadGeometry( Vector4 texCoords );
+ /**
+ * @brief Returns an image to be used when a visual has failed to correctly render
+ * @return The broken image handle.
+ */
+ static Image GetBrokenVisualImage();
+
public:
/**
bool CleanRendererCache( const std::string& key );
/**
- * @brief Cache the debug renderer
+ * @brief Cache the wireframe renderer
+ */
+ void CacheWireframeRenderer( Renderer& renderer );
+
+ /**
+ * @brief Request the wireframe renderer;
*/
- void CacheDebugRenderer( Renderer& renderer );
+ Renderer GetWireframeRenderer();
/**
- * @brief Request the debug renderer;
+ * Get the image atlas manager.
+ * @return A pointer pointing to the atlas manager
*/
- Renderer GetDebugRenderer();
+ ImageAtlasManagerPtr GetAtlasManager();
/**
* Get the SVG rasterization thread.
HashVector mRendererHashes;
CachedRenderers mRenderers;
- Renderer mDebugRenderer;
+ Renderer mWireframeRenderer;
+ ImageAtlasManagerPtr mAtlasManager;
SvgRasterizeThread* mSvgRasterizeThread;
};
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/internal/visuals/border/border-visual.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
-#include <dali-toolkit/internal/visuals/debug/debug-visual.h>
#include <dali-toolkit/internal/visuals/gradient/gradient-visual.h>
-#include <dali-toolkit/internal/visuals/npatch/npatch-visual.h>
+#include <dali-toolkit/internal/visuals/image/batch-image-visual.h>
#include <dali-toolkit/internal/visuals/image/image-visual.h>
-#include <dali-toolkit/internal/visuals/svg/svg-visual.h>
#include <dali-toolkit/internal/visuals/mesh/mesh-visual.h>
+#include <dali-toolkit/internal/visuals/npatch/npatch-visual.h>
#include <dali-toolkit/internal/visuals/primitive/primitive-visual.h>
+#include <dali-toolkit/internal/visuals/svg/svg-visual.h>
+#include <dali-toolkit/internal/visuals/wireframe/wireframe-visual.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+#include <dali-toolkit/internal/visuals/visual-factory-resolve-url.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
-#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
-#include <dali-toolkit/internal/visuals/image/batch-image-visual.h>
-
-namespace
-{
-const char * const BROKEN_VISUAL_IMAGE_URL( DALI_IMAGE_DIR "broken.png");
-}
namespace Dali
{
DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, IMAGE )
DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, MESH )
DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, PRIMITIVE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, DEBUG )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, BATCH_IMAGE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, WIREFRAME )
DALI_ENUM_TO_STRING_TABLE_END( VISUAL_TYPE )
const char * const VISUAL_TYPE( "visualType" );
const char * const BATCHING_ENABLED( "batchingEnabled" );
-
BaseHandle Create()
{
BaseHandle handle = Toolkit::VisualFactory::Get();
mFactoryCache = new VisualFactoryCache();
}
- // Return a new DebugVisual if we have debug enabled
+ // Return a new WireframeVisual if we have debug enabled
if( mDebugEnabled )
{
- return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) );
+ return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) );
}
Visual::Base* visualPtr = NULL;
Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType );
}
- // If the type is IMAGE, either from a default or the TYPE value in the property-map, change it to a BatchImage if required.
- if( visualType == Toolkit::Visual::IMAGE )
- {
- bool batchingEnabled( false );
- Property::Value* value = propertyMap.Find( Toolkit::Visual::Property::BATCHING_ENABLED, BATCHING_ENABLED );
- if( value )
- {
- value->Get( batchingEnabled );
- if( batchingEnabled )
- {
- visualType = Toolkit::Visual::BATCH_IMAGE;
- }
- }
- }
-
switch( visualType )
{
case Toolkit::Visual::BORDER:
break;
}
- default: // Default to Image type if unknown (check if there is a URL)
case Toolkit::Visual::IMAGE:
{
Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME );
std::string imageUrl;
if( imageURLValue && imageURLValue->Get( imageUrl ) )
{
- if( NinePatchImage::IsNinePatchUrl( imageUrl ) )
+ // first resolve url type to know which visual to create
+ UrlType::Type type = ResolveUrlType( imageUrl );
+ if( UrlType::N_PATCH == type )
{
visualPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
}
- else
+ else if( UrlType::SVG == type )
{
- CreateAtlasManager();
-
- if( SvgVisual::IsSvgUrl( imageUrl ) )
+ visualPtr = new SvgVisual( *( mFactoryCache.Get() ) );
+ }
+ else // Regular image
+ {
+ Property::Value* batchingEnabledValue = propertyMap.Find( Toolkit::ImageVisual::Property::BATCHING_ENABLED, BATCHING_ENABLED );
+ if( batchingEnabledValue )
{
- visualPtr = new SvgVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ bool batchingEnabled( false );
+ batchingEnabledValue->Get( batchingEnabled );
+ if( batchingEnabled )
+ {
+ visualPtr = new BatchImageVisual( *( mFactoryCache.Get() ) );
+ break;
+ }
}
else
{
- visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ visualPtr = new ImageVisual( *( mFactoryCache.Get() ) );
}
}
}
- else if( propertyMap.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER ) )
- {
- // Create Image Visual if it has a shader
- // TODO: This is required because of EffectsView which should be fixed
- CreateAtlasManager();
- visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
- }
+
break;
}
break;
}
- case Toolkit::Visual::DEBUG:
+ case Toolkit::Visual::WIREFRAME:
{
- visualPtr = new DebugVisual( *( mFactoryCache.Get() ) );
+ visualPtr = new WireframeVisual( *( mFactoryCache.Get() ) );
break;
}
- case Toolkit::Visual::BATCH_IMAGE:
- {
- CreateAtlasManager();
- visualPtr = new BatchImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
- break;
- }
}
if( visualPtr )
if( mDebugEnabled )
{
- return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) );
+ return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) );
}
NinePatchImage npatchImage = NinePatchImage::DownCast( image );
}
else
{
- CreateAtlasManager();
- ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ) );
Actor actor;
visualPtr->SetImage( actor, image );
if( mDebugEnabled )
{
- return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) );
+ return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) );
}
- if( NinePatchImage::IsNinePatchUrl( url ) )
+ // first resolve url type to know which visual to create
+ UrlType::Type type = ResolveUrlType( url );
+ if( UrlType::N_PATCH == type )
{
NPatchVisual* visualPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
visualPtr->SetImage( url );
return Toolkit::Visual::Base( visualPtr );
}
- else if( SvgVisual::IsSvgUrl( url ) )
+ else if( UrlType::SVG == type )
{
- CreateAtlasManager();
- SvgVisual* visualPtr = new SvgVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ SvgVisual* visualPtr = new SvgVisual( *( mFactoryCache.Get() ) );
visualPtr->SetImage( url, size );
return Toolkit::Visual::Base( visualPtr );
}
- else
+ else // Regular image
{
- CreateAtlasManager();
- ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ), *( mAtlasManager.Get() ) );
+ ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ));
Actor actor;
visualPtr->SetImage( actor, url, size );
}
}
-Image VisualFactory::GetBrokenVisualImage()
-{
- return ResourceImage::New( BROKEN_VISUAL_IMAGE_URL );
-}
-
-void VisualFactory::CreateAtlasManager()
-{
- if( !mAtlasManager )
- {
- Shader shader = ImageVisual::GetImageShader( *( mFactoryCache.Get() ) );
- mAtlasManager = new ImageAtlasManager();
- mAtlasManager->SetBrokenImage( BROKEN_VISUAL_IMAGE_URL );
- }
-}
-
} // namespace Internal
} // namespace Toolkit
class VisualFactoryCache;
typedef IntrusivePtr<VisualFactoryCache> VisualFactoryCachePtr;
-class ImageAtlasManager;
-typedef IntrusivePtr<ImageAtlasManager> ImageAtlasManagerPtr;
-
/**
* @copydoc Toolkit::VisualFactory
*/
*/
Toolkit::Visual::Base CreateVisual( const std::string& image, ImageDimensions size );
-public:
- /**
- * @brief Returns an image to be used when a visual has failed to correctly render
- */
- static Image GetBrokenVisualImage();
protected:
private:
- /**
- * Prepare the atlas manager
- */
- void CreateAtlasManager();
-
/**
* Undefined copy constructor.
*/
private:
VisualFactoryCachePtr mFactoryCache;
- ImageAtlasManagerPtr mAtlasManager;
bool mDebugEnabled;
};
--- /dev/null
+#ifndef DALI_TOOLKIT_VISUAL_FACTORY_URL_RESOLVE_H
+#define DALI_TOOLKIT_VISUAL_FACTORY_URL_RESOLVE_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ctype.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace UrlType
+{
+ /**
+ * The type of the URL based on the string contents
+ */
+ enum Type
+ {
+ REGULAR_IMAGE,
+ N_PATCH,
+ SVG
+ };
+}
+
+/**
+ * Helper to resolve URL type from the string
+ * @param[in] url to check
+ * @return UrlType
+ */
+inline UrlType::Type ResolveUrlType( const std::string& url )
+{
+ // if only one char in string, can only be regular image
+ const std::size_t count = url.size();
+ if( count > 0 )
+ {
+ // parsing from the end for better chance of early outs
+ enum { SUFFIX, HASH, HASH_DOT } state = SUFFIX;
+ char SVG[ 4 ] = { 'g', 'v', 's', '.' };
+ unsigned int svgScore = 0;
+ int index = count;
+ while( --index >= 0 )
+ {
+ const char currentChar = url[ index ];
+ const std::size_t offsetFromEnd = count - index - 1u;
+ if( ( offsetFromEnd < sizeof(SVG) )&&( tolower( currentChar ) == SVG[ offsetFromEnd ] ) )
+ {
+ // early out if SVG as can't be used in N patch for now
+ if( ++svgScore == sizeof(SVG) )
+ {
+ return UrlType::SVG;
+ }
+ }
+ switch( state )
+ {
+ case SUFFIX:
+ {
+ if( '.' == currentChar )
+ {
+ state = HASH;
+ }
+ break;
+ }
+ case HASH:
+ {
+ if( ( '#' == currentChar ) || ( '9' == currentChar ) )
+ {
+ state = HASH_DOT;
+ }
+ else
+ {
+ // early out, not a valid N/9-patch URL
+ return UrlType::REGULAR_IMAGE;
+ }
+ break;
+ }
+ case HASH_DOT:
+ {
+ if( '.' == currentChar )
+ {
+ return UrlType::N_PATCH;
+ }
+ else
+ {
+ // early out, not a valid N/9-patch URL
+ return UrlType::REGULAR_IMAGE;
+ }
+ break;
+ }
+ }
+ }
+ }
+ // if we got here it is a regular image
+ return UrlType::REGULAR_IMAGE;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* DALI_TOOLKIT_VISUAL_FACTORY_URL_RESOLVE_H */
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+// CLASS HEADER
+#include "wireframe-visual.h"
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
+#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace
+{
+const char * const POSITION_ATTRIBUTE_NAME("aPosition");
+const char * const INDEX_NAME("indices");
+
+const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
+attribute mediump vec2 aPosition;\n
+uniform mediump mat4 uMvpMatrix;\n
+uniform mediump vec3 uSize;\n
+\n
+void main()\n
+{\n
+ mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
+ vertexPosition.xyz *= uSize;\n
+ gl_Position = uMvpMatrix * vertexPosition;\n
+}\n
+);
+
+const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(\n
+uniform lowp vec4 uColor;\n
+\n
+void main()\n
+{\n
+ gl_FragColor = uColor;\n
+}\n
+);
+
+}
+
+
+WireframeVisual::WireframeVisual( VisualFactoryCache& factoryCache )
+: Visual::Base( factoryCache )
+{
+}
+
+WireframeVisual::~WireframeVisual()
+{}
+
+void WireframeVisual::DoSetOnStage( Actor& actor )
+{
+ InitializeRenderer();
+
+ actor.AddRenderer( mImpl->mRenderer );
+}
+
+void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const
+{
+ map.Clear();
+ map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::WIREFRAME );
+}
+
+void WireframeVisual::InitializeRenderer()
+{
+ mImpl->mRenderer = mFactoryCache.GetWireframeRenderer();
+ if( !mImpl->mRenderer )
+ {
+ Geometry geometry = CreateQuadWireframeGeometry();
+ Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
+
+ mImpl->mRenderer = Renderer::New( geometry, shader);
+ mFactoryCache.CacheWireframeRenderer( mImpl->mRenderer );
+ }
+}
+
+Geometry WireframeVisual::CreateQuadWireframeGeometry()
+{
+ const float halfWidth = 0.5f;
+ const float halfHeight = 0.5f;
+ struct QuadVertex { Vector2 position;};
+ QuadVertex quadVertexData[4] =
+ {
+ { Vector2(-halfWidth, -halfHeight) },
+ { Vector2( halfWidth, -halfHeight) },
+ { Vector2( halfWidth, halfHeight) },
+ { Vector2(-halfWidth, halfHeight) }
+ };
+
+ Property::Map quadVertexFormat;
+ quadVertexFormat[POSITION_ATTRIBUTE_NAME] = Property::VECTOR2;
+ PropertyBuffer quadVertices = PropertyBuffer::New( quadVertexFormat );
+ quadVertices.SetData( quadVertexData, 4 );
+
+ // Create indices
+ unsigned short indexData[10] = { 0, 1, 1, 2, 2, 3, 3, 0 };
+
+ // Create the geometry object
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer( quadVertices );
+ geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+ geometry.SetType( Geometry::LINES );
+
+ return geometry;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H
+#define DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+/**
+ * The visual which renders a wireframe outline to the control's quad.
+ *
+ */
+class WireframeVisual: public Visual::Base
+{
+public:
+
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ */
+ WireframeVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~WireframeVisual();
+
+protected:
+
+ /**
+ * @copydoc Visual::Base::DoSetOnStage
+ */
+ virtual void DoSetOnStage( Actor& actor );
+
+ /**
+ * @copydoc Visual::Base::CreatePropertyMap
+ */
+ virtual void DoCreatePropertyMap( Property::Map& map ) const;
+
+
+private:
+ /**
+ * Create the geometry which presents the quad wireframe.
+ * @return The border geometry
+ */
+ Geometry CreateQuadWireframeGeometry();
+
+ /**
+ * @brief Initialise the renderer from the cache, if not available, create and save to the cache for sharing.
+ */
+ void InitializeRenderer();
+
+private:
+
+ // Undefined
+ WireframeVisual( const WireframeVisual& visual);
+
+ // Undefined
+ WireframeVisual& operator=( const WireframeVisual& visual );
+
+};
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL Alignment( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL Button( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
*
* When the button is disabled, \e background image and \e selected image are replaced by \e disabled images.
*
+ * Usage example: -
+ *
+ * @code
+ * // in Creating a DALi Application
+ * void HelloWorldExample::Create( Application& application )
+ * {
+ * CheckBoxButton button = CheckBoxButton::New();
+ * button.SetParentOrigin( ParentOrigin::CENTER );
+ * button.SetLabelText( "Check" );
+ * button.SetSize( 200, 40 );
+ * button.SetBackgroundColor( Color::WHITE );
+ * Stage::GetCurrent().Add( button );
+ *
+ * // Connect to a button signal emitted by the button
+ * button.StateChangedSignal().Connect( this, &HelloWorldExample::OnButtonStateChanged );
+ * }
+ *
+ * bool HelloWorldExample::OnButtonStateChanged( Button button )
+ * {
+ * // Do something when the button state is changed
+ * // You can get the state using button.IsSelected() call
+ * return true;
+ * }
+ * @endcode
* @SINCE_1_0.0
*/
class DALI_IMPORT_API CheckBoxButton : public Button
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
* @SINCE_1_0.0
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL CheckBoxButton( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
* By default a PushButton emits a Button::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked
* and a Button::ReleasedSignal() signal when it's released or having pressed it, the touch point leaves the boundary of the button.
*
+ * Usage example: -
+ *
+ * @code
+ * // in Creating a DALi Application
+ * void HelloWorldExample::Create( Application& application )
+ * {
+ * PushButton button = PushButton::New();
+ * button.SetParentOrigin( ParentOrigin::CENTER );
+ * button.SetLabelText( "Press" );
+ * Stage::GetCurrent().Add( button );
+ *
+ * // Connect to button signals emitted by the button
+ * button.ClickedSignal().Connect( this, &HelloWorldExample::OnButtonClicked );
+ * button.PressedSignal().Connect( this, &HelloWorldExample::OnButtonPressed );
+ * button.ReleasedSignal().Connect( this, &HelloWorldExample::OnButtonReleased );
+ * }
+ *
+ * bool HelloWorldExample::OnButtonClicked( Button button )
+ * {
+ * // Do something when the button is clicked
+ * return true;
+ * }
+ *
+ * bool HelloWorldExample::OnButtonPressed( Button button )
+ * {
+ * // Do something when the button is pressed
+ * return true;
+ * }
+ *
+ * bool HelloWorldExample::OnButtonReleased( Button button )
+ * {
+ * // Do something when the button is released
+ * return true;
+ * }
+ * @endcode
+ *
* See Button for more detail on signals and modifying appearance via properties.
* @SINCE_1_0.0
*/
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL RadioButton( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/rendering/renderer.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
+#include <dali/devel-api/common/owner-container.h>
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
RegisteredVisual( Property::Index aIndex, Toolkit::Visual::Base &aVisual, Actor &aPlacementActor) : index(aIndex), visual(aVisual), placementActor(aPlacementActor) {}
};
+typedef Dali::OwnerContainer< RegisteredVisual* > RegisteredVisuals;
+
/**
* Finds visual in given array, returning true if found along with the iterator for that visual as a out parameter
*/
-bool FindVisual( Property::Index targetIndex, std::vector<RegisteredVisual>& visuals, std::vector<RegisteredVisual>::iterator& iter )
+bool FindVisual( Property::Index targetIndex, RegisteredVisuals& visuals, RegisteredVisuals::Iterator& iter )
{
- for ( iter = visuals.begin(); iter != visuals.end(); iter++ )
+ for ( iter = visuals.Begin(); iter != visuals.End(); iter++ )
{
- if ( (*iter).index == targetIndex )
+ if ( (*iter)->index == targetIndex )
{
return true;
}
// Data
Control& mControlImpl;
- std::vector<RegisteredVisual> mVisuals; // Stores visuals needed by the control, non trivial type so std::vector used.
+ RegisteredVisuals mVisuals; // Stores visuals needed by the control, non trivial type so std::vector used.
std::string mStyleName;
Toolkit::Visual::Base mBackgroundVisual; ///< The visual to render the background
Vector4 mBackgroundColor; ///< The color of the background visual
Property::Map map;
map[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
- InitializeVisual( self, mImpl->mBackgroundVisual, map );
+ mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, self, mImpl->mBackgroundVisual );
if( mImpl->mBackgroundVisual )
{
mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
void Control::SetBackground( const Property::Map& map )
{
Actor self( Self() );
- InitializeVisual( self, mImpl->mBackgroundVisual, map );
+ mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( map );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, self, mImpl->mBackgroundVisual );
if( mImpl->mBackgroundVisual )
{
mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
void Control::SetBackgroundImage( Image image )
{
Actor self( Self() );
- InitializeVisual( self, mImpl->mBackgroundVisual, image );
+ mImpl->mBackgroundVisual = Toolkit::VisualFactory::Get().CreateVisual( image );
+ RegisterVisual( Toolkit::Control::Property::BACKGROUND, self, mImpl->mBackgroundVisual );
if( mImpl->mBackgroundVisual )
{
mImpl->mBackgroundVisual.SetDepthIndex( DepthIndex::BACKGROUND );
{
Actor self( Self() );
mImpl->mBackgroundVisual.RemoveAndReset( self );
+ mImpl->mBackgroundColor = Color::TRANSPARENT;
}
void Control::EnableGestureDetection(Gesture::Type type)
OnKeyboardEnter();
}
-void Control::RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual )
+void Control::RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual )
{
bool visualReplaced ( false );
Actor actorToRegister; // Null actor, replaced if placement actor not Self
+ Actor self = Self();
- if ( placementActor != Self() ) // Prevent increasing ref count if actor self
+ if ( placementActor != self ) // Prevent increasing ref count if actor self
{
actorToRegister = placementActor;
}
- if ( !mImpl->mVisuals.empty() )
+ if ( !mImpl->mVisuals.Empty() )
{
- std::vector<RegisteredVisual>::iterator iter;
+ RegisteredVisuals::Iterator iter;
// Check if visual (index) is already registered. Replace if so.
if ( FindVisual( index, mImpl->mVisuals, iter ) )
{
- (*iter).visual = visual;
- (*iter).placementActor = actorToRegister;
+ if( (*iter)->visual && self.OnStage() )
+ {
+ if( (*iter)->placementActor )
+ {
+ (*iter)->visual.SetOffStage( (*iter)->placementActor );
+ }
+ else
+ {
+ (*iter)->visual.SetOffStage( self );
+ }
+ }
+ (*iter)->visual = visual;
+ (*iter)->placementActor = actorToRegister;
visualReplaced = true;
}
}
if ( !visualReplaced ) // New registration entry
{
- RegisteredVisual newVisual = RegisteredVisual( index, visual, actorToRegister );
- mImpl->mVisuals.push_back( newVisual );
+ mImpl->mVisuals.PushBack( new RegisteredVisual( index, visual, actorToRegister ) );
+ }
+
+ if( visual && self.OnStage() )
+ {
+ visual.SetOnStage( placementActor );
}
}
void Control::UnregisterVisual( Property::Index index )
{
- std::vector< RegisteredVisual >::iterator iter;
+ RegisteredVisuals::Iterator iter;
if ( FindVisual( index, mImpl->mVisuals, iter ) )
{
- mImpl->mVisuals.erase( iter );
+ mImpl->mVisuals.Erase( iter );
}
}
+Toolkit::Visual::Base Control::GetVisual( Property::Index index ) const
+{
+ RegisteredVisuals::Iterator iter;
+ if ( FindVisual( index, mImpl->mVisuals, iter ) )
+ {
+ return (*iter)->visual;
+ }
+
+ return Toolkit::Visual::Base();
+}
+
+Actor Control::GetPlacementActor( Property::Index index ) const
+{
+ RegisteredVisuals::Iterator iter;
+ if ( FindVisual( index, mImpl->mVisuals, iter ) )
+ {
+ if( (*iter)->placementActor )
+ {
+ return (*iter)->placementActor;
+ }
+ else
+ {
+ return Self();
+ }
+ }
+
+ return Actor();
+}
+
bool Control::OnAccessibilityActivated()
{
return false; // Accessibility activation is not handled by default
{
GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
}
+ RelayoutRequest();
}
void Control::OnPinch(const PinchGesture& pinch)
void Control::OnStageConnection( int depth )
{
- if( mImpl->mBackgroundVisual)
+ for(RegisteredVisuals::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
{
- Actor self( Self() );
- mImpl->mBackgroundVisual.SetOnStage( self );
+ // Check whether the visual is empty, as it is allowed to register a placement actor without visual.
+ if( (*iter)->visual )
+ {
+ if( (*iter)->placementActor )
+ {
+ (*iter)->visual.SetOnStage( (*iter)->placementActor );
+ }
+ else
+ {
+ Actor self( Self() );
+ (*iter)->visual.SetOnStage( self );
+ }
+ }
}
}
void Control::OnStageDisconnection()
{
- if( mImpl->mBackgroundVisual )
+ for(RegisteredVisuals::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
{
- Actor self( Self() );
- mImpl->mBackgroundVisual.SetOffStage( self );
+ // Check whether the visual is empty, as it is allowed to register a placement actor without visual.
+ if( (*iter)->visual )
+ {
+ if( (*iter)->placementActor )
+ {
+ (*iter)->visual.SetOffStage( (*iter)->placementActor );
+ }
+ else
+ {
+ Actor self( Self() );
+ (*iter)->visual.SetOffStage( self );
+ }
+ }
}
}
*/
bool IsKeyboardFocusGroup();
+ /// @cond internal
/**
* @brief Called by the AccessibilityManager to activate the Control.
* @SINCE_1_0.0
* @SINCE_1_0.0
*/
DALI_INTERNAL void KeyboardEnter();
+ /// @endcond
// Signals
*/
Toolkit::Control::KeyInputFocusSignalType& KeyInputFocusLostSignal();
+ /// @cond internal
/**
* @brief Called by the KeyInputFocusManager to emit key event signals.
*
* @return True if the event was consumed.
*/
DALI_INTERNAL bool EmitKeyEventSignal( const KeyEvent& event );
+ /// @endcond
protected: // For derived classes to call
* In the case of the visual being an actor or control deeming controlRenderer not required then controlRenderer should be an empty handle.
* No parenting is done during registration, this should be done by derived class.
*
- * @SINCE_1_1.46
+ * @SINCE_1_2.0
*
* @param[in] index The Property index of the visual, used to reference visual
* @param[in] placementActor The actor used to by the visual.
* @param[in] visual The visual to register
+ * @note Derived class must NOT call visual.SetOnStage(placementActor). It is the responsibility of the base class to connect/disconnect registered visual to stage.
*/
- void RegisterVisual( Property::Index index, Actor placementActor, Toolkit::Visual::Base visual );
+ void RegisterVisual( Property::Index index, Actor& placementActor, Toolkit::Visual::Base& visual );
/**
* @brief Erase the entry matching the given index from the list of registered visuals
* @param[in] index The Property index of the visual, used to reference visual
*
- * @SINCE_1_1.46
+ * @SINCE_1_2.0
*/
void UnregisterVisual( Property::Index index );
+ /**
+ * @brief Retrieve the visual associated with the given property index.
+ *
+ * @SINCE_1_2.2
+ *
+ * @param[in] index The Property index of the visual.
+ * @return The registered visual if exist, otherwise empty handle.
+ * @note For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
+ */
+ Toolkit::Visual::Base GetVisual( Property::Index index ) const;
+
+ /**
+ * @brief Retrieve the placement actor associated with the given index.
+ *
+ * @SINCE_1_2.2
+ *
+ * @@param[in] index The Property index of the visual.
+ * @return Then placement actor if exist, otherwise empty handle.
+ * @note For managing object life-cycle, do not store the returned placement actor as a member which increments its reference count.
+ */
+ Actor GetPlacementActor( Property::Index index ) const;
+
/**
* @brief Emits KeyInputFocusGained signal if true else emits KeyInputFocusLost signal
*
private:
+ /// @cond internal
// Undefined
DALI_INTERNAL Control( const Control& );
DALI_INTERNAL Control& operator=( const Control& );
class Impl;
Impl* mImpl;
+ /// @endcond
};
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/images/buffer-image.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace
-{
-const unsigned int MAX_BORDER_SIZE( 9 );
-}
-
-ImageActor CreateSolidColorActor( const Vector4& color, bool border, const Vector4& borderColor, const unsigned int borderSize )
-{
- ImageActor image;
- if( borderSize > MAX_BORDER_SIZE )
- {
- return image;
- }
-
- const unsigned int bitmapWidth = borderSize * 2 + 2;
- bool needAlphaChannel = (color.a < 1.0f) || ( border && borderColor.a < 1.0f );
- BufferImage imageData;
- if( needAlphaChannel )
- {
- imageData = BufferImage::New( bitmapWidth, bitmapWidth, Pixel::RGBA8888 );
- }
- else
- {
- imageData = BufferImage::New( bitmapWidth, bitmapWidth, Pixel::RGB888 );
- }
-
- // Create the image
- PixelBuffer* pixbuf = imageData.GetBuffer();
- if( !pixbuf )
- {
- return image;
- }
-
- Vector4 outerColor = color;
- if ( border )
- {
- outerColor = borderColor;
- }
-
- // Using a (2 + border) x (2 + border) image gives a better blend with the GL implementation
- // than a (1 + border) x (1 + border) image
- const unsigned int bitmapSize = bitmapWidth * bitmapWidth;
- const unsigned int topLeft = bitmapWidth * borderSize + borderSize;
- const unsigned int topRight = topLeft + 1;
- const unsigned int bottomLeft = bitmapWidth * (borderSize + 1) + borderSize;
- const unsigned int bottomRight = bottomLeft + 1;
-
- if( needAlphaChannel )
- {
- for( size_t i = 0; i < bitmapSize; ++i )
- {
- if( i == topLeft ||
- i == topRight ||
- i == bottomLeft ||
- i == bottomRight )
- {
- pixbuf[i*4+0] = 0xFF * color.r;
- pixbuf[i*4+1] = 0xFF * color.g;
- pixbuf[i*4+2] = 0xFF * color.b;
- pixbuf[i*4+3] = 0xFF * color.a;
- }
- else
- {
- pixbuf[i*4+0] = 0xFF * outerColor.r;
- pixbuf[i*4+1] = 0xFF * outerColor.g;
- pixbuf[i*4+2] = 0xFF * outerColor.b;
- pixbuf[i*4+3] = 0xFF * outerColor.a;
- }
- }
- }
- else
- {
- for( size_t i = 0; i < bitmapSize; ++i )
- {
- if( i == topLeft ||
- i == topRight ||
- i == bottomLeft ||
- i == bottomRight )
- {
- pixbuf[i*3+0] = 0xFF * color.r;
- pixbuf[i*3+1] = 0xFF * color.g;
- pixbuf[i*3+2] = 0xFF * color.b;
- }
- else
- {
- pixbuf[i*3+0] = 0xFF * outerColor.r;
- pixbuf[i*3+1] = 0xFF * outerColor.g;
- pixbuf[i*3+2] = 0xFF * outerColor.b;
- }
- }
- }
-
- imageData.Update();
- image = ImageActor::New( imageData );
- image.SetParentOrigin( ParentOrigin::CENTER );
-
- if( border )
- {
- image.SetStyle( ImageActor::STYLE_NINE_PATCH );
- image.SetNinePatchBorder( Vector4::ONE * (float)borderSize * 2.0f );
- }
-
- return image;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_SOLID_COLOR_ACTOR_H__
-#define __DALI_TOOLKIT_SOLID_COLOR_ACTOR_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/actors/image-actor.h>
-
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-/**
- * @brief Creates a Dali::ImageActor with a solid color, optionally it creates a border.
- *
- * If the \e border parameter is set to \e true, the Dali::ImageActor's style is set to Dali::ImageActor::STYLE_NINE_PATCH.
- *
- * @SINCE_1_0.0
- * @remarks This is an experimental feature and might not be supported in the next release. We do recommend not to use it.
- * @param[in] color The ImageActor's color.
- * @param[in] border If \e true, a border is created. By default, the value is set to \e false.
- * @param[in] borderColor The color for the ImageActor's border. By default, the value is set to Color::WHITE.
- * @param[in] borderSize The size for the ImageActor's border. By default, the value is set to 1 pixel. It supports under 10 pixel for clear result of gl blend
- * @return a handle to the new ImageActor
- * @see Control
- */
-DALI_IMPORT_API ImageActor CreateSolidColorActor( const Vector4& color, bool border = false, const Vector4& borderColor = Color::WHITE, const unsigned int borderSize = 1 );
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_SOLID_COLOR_ACTOR_H__
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
* @SINCE_1_1.35
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL FlexContainer( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
-
-// EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-GaussianBlurView::GaussianBlurView()
-{
-}
-
-GaussianBlurView::~GaussianBlurView()
-{
-}
-
-GaussianBlurView::GaussianBlurView(const GaussianBlurView& handle)
- : Control( handle )
-{
-}
-
-GaussianBlurView& GaussianBlurView::operator=(const GaussianBlurView& rhs)
-{
- if( &rhs != this )
- {
- Control::operator=(rhs);
- }
- return *this;
-}
-
-GaussianBlurView GaussianBlurView::New()
-{
- return Internal::GaussianBlurView::New();
-}
-
-GaussianBlurView GaussianBlurView::New( const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
- const float downsampleWidthScale, const float downsampleHeightScale,
- bool blurUserImage)
-{
- return Internal::GaussianBlurView::New( numSamples, blurBellCurveWidth, renderTargetPixelFormat,
- downsampleWidthScale, downsampleHeightScale,
- blurUserImage);
-}
-
-GaussianBlurView::GaussianBlurView( Internal::GaussianBlurView& implementation )
-: Control( implementation )
-{
-}
-
-GaussianBlurView::GaussianBlurView( Dali::Internal::CustomActor* internal )
-: Control( internal )
-{
- VerifyCustomActorPointer<Internal::GaussianBlurView>(internal);
-}
-
-GaussianBlurView GaussianBlurView::DownCast( BaseHandle handle )
-{
- return Control::DownCast<GaussianBlurView, Internal::GaussianBlurView>(handle);
-}
-
-void GaussianBlurView::Add(Actor child)
-{
- GetImpl(*this).Add(child);
-}
-
-void GaussianBlurView::Remove(Actor child)
-{
- GetImpl(*this).Remove(child);
-}
-
-void GaussianBlurView::Activate()
-{
- GetImpl(*this).Activate();
-}
-
-void GaussianBlurView::ActivateOnce()
-{
- GetImpl(*this).ActivateOnce();
-}
-
-void GaussianBlurView::Deactivate()
-{
- GetImpl(*this).Deactivate();
-}
-
-void GaussianBlurView::SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget)
-{
- GetImpl(*this).SetUserImageAndOutputRenderTarget(inputImage, outputRenderTarget);
-}
-
-Property::Index GaussianBlurView::GetBlurStrengthPropertyIndex() const
-{
- return GetImpl(*this).GetBlurStrengthPropertyIndex();
-}
-
-FrameBufferImage GaussianBlurView::GetBlurredRenderTarget() const
-{
- return GetImpl(*this).GetBlurredRenderTarget();
-}
-
-void GaussianBlurView::SetBackgroundColor( const Vector4& color )
-{
- GetImpl(*this).SetBackgroundColor(color);
-}
-
-Vector4 GaussianBlurView::GetBackgroundColor() const
-{
- return GetImpl(*this).GetBackgroundColor();
-}
-
-GaussianBlurView::GaussianBlurViewSignal& GaussianBlurView::FinishedSignal()
-{
- return GetImpl(*this).FinishedSignal();
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_GAUSSIAN_BLUR_EFFECT_H__
-#define __DALI_TOOLKIT_GAUSSIAN_BLUR_EFFECT_H__
-
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/actors/camera-actor.h>
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/public-api/render-tasks/render-task.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal DALI_INTERNAL
-{
-
-/**
- * GaussianBlurView implementation class
- */
-class GaussianBlurView;
-
-/**
- * BloomView implementation class - requires access to private methods
- */
-class BloomView;
-
-} // namespace Internal
-/**
- * @addtogroup dali_toolkit_controls_gaussian_blur_view
- * @{
- */
-
-/**
- * @brief
- * GaussianBlurView is a class for applying a render process that blurs an image.
- *
- * Basic idea:-
- *
- * 1) The GaussianBlurView object will render all its child actors offscreen.\n
- * 2) The GaussianBlurView object then blurs the result of step 1), using a two pass separated Gaussian blur.\n
- * 3) The GaussianBlurView object then composites the blur from step 2) with the child actors image from step 1). See GetBlurStrengthPropertyIndex() for more info.\n
- * 4) The GaussianBlurView object gets rendered automatically, either to the screen via the default render task, or via a RenderTask the user has created for
- * e.g. further offscreen rendering.
- *
- * Fundamentally, the GaussianBlurView is simply an Actor in the normal actor tree that affects all of its children. It should be added to your Actor tree and manipulated in the
- * normal ways. It can be considered a 'portal' in the sense that all child actors are clipped to the GaussianBlurView actor bounds.
- *
- * ************\n
- * NB: It is essential to remove the GaussianBlurView from the stage and also to call Deactivate() on it when you are not using it. This will ensure that resources are freed and
- * rendering stops.\n
- * ************\n
- *
- * Usage example:-
- *
- * @code
- * // Initialise
- * GaussianBlurView gaussianBlurView = GaussianBlurView::New();
- *
- * // Create and add some visible actors to the GaussianBlurView, all these child actors will therefore get blurred.
- * Image image = Image::New(...);
- * ImageView imageView = ImageView::New(image);
- * gaussianBlurView.Add(imageView);
- * ...
- *
- * // Start rendering the GaussianBlurView
- * Stage::GetCurrent().Add(gaussianBlurView);
- * gaussianBlurView.Activate();
- * ...
- *
- * // Animate the strength of the blur - this can fade between no blur and full blur. See GetBlurStrengthPropertyIndex().
- * Animation blurAnimation = Animation::New( ... );
- * blurAnimation.AnimateTo( Property( gaussianBlurView, gaussianBlurView.GetBlurStrengthPropertyIndex() ), ... );
- * blurAnimation.Play();
- *
- * ...
- * // Stop rendering the GaussianBlurView
- * Stage::GetCurrent().Remove(gaussianBlurView);
- * gaussianBlurView.Deactivate();
- * @endcode
- * @SINCE_1_0.0
- * @remarks This is an experimental feature and might not be supported in the next release.
- * We do recommend not to use this class.
- */
-class DALI_IMPORT_API GaussianBlurView : public Control
-{
-public:
- /**
- * @brief Signal type for notifications
- * @SINCE_1_0.0
- */
- typedef Signal< void (GaussianBlurView source) > GaussianBlurViewSignal;
-
- /**
- * @brief Create an uninitialized GaussianBlurView; this can be initialized with GaussianBlurView::New().
- * Calling member functions with an uninitialized Dali::Object is not allowed.
- * @SINCE_1_0.0
- */
- GaussianBlurView();
-
- /**
- * @brief Copy constructor. Creates another handle that points to the same real object.
- * @SINCE_1_0.0
- */
- GaussianBlurView(const GaussianBlurView& handle);
-
- /**
- * @brief Assignment operator. Changes this handle to point to another real object.
- * @SINCE_1_0.0
- */
- GaussianBlurView& operator=(const GaussianBlurView& ZoomView);
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- * @SINCE_1_0.0
- */
- ~GaussianBlurView();
-
- /**
- * @brief Downcast a handle to GaussianBlurView handle.
- *
- * If handle points to a GaussianBlurView the
- * downcast produces valid handle. If not the returned handle is left uninitialized.
- * @SINCE_1_0.0
- * @param[in] handle Handle to an object
- * @return A handle to a GaussianBlurView or an uninitialized handle
- */
- static GaussianBlurView DownCast( BaseHandle handle );
-
- /**
- * @brief Create an initialized GaussianBlurView, using default settings. The default settings are:-\n
- *
- * numSamples = 5\n
- * blurBellCurveWidth = 1.5\n
- * renderTargetPixelFormat = RGB888\n
- * downsampleWidthScale = 0.5\n
- * downsampleHeightScale = 0.5\n
- * blurUserImage = false
- * @SINCE_1_0.0
- * @return A handle to a newly allocated Dali resource
- */
- static GaussianBlurView New();
-
- /**
- * @brief Create an initialized GaussianBlurView.
- * @SINCE_1_0.0
- * @param numSamples The size of the Gaussian blur kernel (number of samples in horizontal / vertical blur directions).
- * @param blurBellCurveWidth The constant controlling the Gaussian function, must be > 0.0. Controls the width of the bell curve, i.e. the look of the blur and also indirectly
- * the amount of blurriness Smaller numbers for a tighter curve. Useful values in the range [0.5..3.0] - near the bottom of that range the curve is weighted heavily towards
- * the centre pixel of the kernel (so there won't be much blur), near the top of that range the pixels have nearly equal weighting (closely approximating a box filter
- * therefore). Values close to zero result in the bell curve lying almost entirely within a single pixel, in other words there will be basically no blur as neighbouring pixels
- * have close to zero weights.
- * @param renderTargetPixelFormat The pixel format of the render targets we are using to perform the blur.
- * @param downsampleWidthScale The width scale factor applied during the blur process, scaling the size of the source image to the size of the final blurred image output.
- * Useful for downsampling - trades visual quality for processing speed. A value of 1.0f results in no scaling applied.
- * @param downsampleHeightScale The height scale factor applied during the blur process, scaling the size of the source image to the size of the final blurred image output.
- * Useful for downsampling - trades visual quality for processing speed. A value of 1.0f results in no scaling applied.
- * @param blurUserImage If this is set to true, the GaussianBlurView object will operate in a special mode that allows the user to blur an image of their choice. See
- * SetUserImageAndOutputRenderTarget().
- * @return A handle to a newly allocated Dali resource
- */
- static GaussianBlurView New(const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
- const float downsampleWidthScale, const float downsampleHeightScale,
- bool blurUserImage = false);
-
- /**
- * @DEPRECATED_1_1.28 Use Actor::Add(Actor) instead
- * @brief Adds a child Actor to this Actor.
- * @SINCE_1_0.0
- * @param [in] child The child.
- * @pre This Actor (the parent) has been initialized.
- * @pre The child actor has been initialized.
- * @pre The child actor is not the same as the parent actor.
- * @pre The actor is not the Root actor
- * @post The child will be referenced by its parent. This means that the child will be kept alive,
- * even if the handle passed into this method is reset or destroyed.
- * @note If the child already has a parent, it will be removed from old parent
- * and reparented to this actor. This may change childs position, color, shader effect,
- * scale etc as it now inherits them from this actor.
- */
- void Add(Actor child);
-
- /**
- * @DEPRECATED_1_1.28 Use Actor::Remove(Actor) instead
- * @brief Removes a child Actor from this Actor.
- *
- * If the actor was not a child of this actor, this is a no-op.
- * @SINCE_1_0.0
- * @param [in] child The child.
- * @pre This Actor (the parent) has been initialized.
- * @pre The child actor is not the same as the parent actor.
- */
- void Remove(Actor child);
-
- /**
- * @brief Start rendering the GaussianBlurView. Must be called after you Add() it to the stage.
- * @SINCE_1_0.0
- */
- void Activate();
-
- /**
- * @brief Render the GaussianBlurView once.
- *
- * Must be called after you Add() it to the stage.
- * Only works with a gaussian blur view created with blurUserImage = true.
- * Listen to the Finished signal to determine when the rendering has completed.
- * @SINCE_1_0.0
- */
- void ActivateOnce();
-
- /**
- * @brief Stop rendering the GaussianBlurView. Must be called after you Remove() it from the stage.
- * @SINCE_1_0.0
- */
- void Deactivate();
-
- /**
- * @brief Sets a custom image to be blurred and a render target to receive the blurred result.
- *
- * If this is called the children of the GaussianBlurObject will not be rendered blurred,
- * instead the inputImage will get blurred.
- * To retrieve the blurred image the user can either pass a handle on a render target they own as the second parameter to SetUserImageAndOutputRenderTarget( ... ), or they
- * can pass NULL for this parameter and instead call GetBlurredRenderTarget() which will return a handle on a render target created internally to the GaussianBlurView object.
- * @SINCE_1_0.0
- * @param inputImage The image that the user wishes to blur.
- * @param outputRenderTarget A render target to receive the blurred result. Passing NULL is allowed. See also GetBlurredRenderTarget().
- * @pre This object was created with a New( ... ) call where the blurUserImage argument was set to true. If this was not the case an exception will be thrown.
- */
- void SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget);
-
- /**
- * @brief Get the index of the property that can be used to fade the blur in / out.
- *
- * This is the overall strength of the blur.
- * User can use this to animate the blur. A value of 0.0 is zero blur and 1.0 is full blur. Default is 1.0.
- * Note that if you set the blur to 0.0, the result will be no blur BUT the internal rendering will still be happening. If you wish to turn the blur off, you should remove
- * the GaussianBlurView object from the stage also.
- * @SINCE_1_0.0
- * @return Index of the property that can be used to fade the blur in / out
- */
- Dali::Property::Index GetBlurStrengthPropertyIndex() const;
-
- /**
- * @brief Get the final blurred image.
- *
- * Use can call this function to get the blurred result as an image, to use as they wish. It is not necessary to call this unless you specifically require it.
- * @SINCE_1_0.0
- * @return A handle on the blurred image, contained in a render target.
- * @pre The user must call Activate() before the render target will be returned.
- */
- FrameBufferImage GetBlurredRenderTarget() const;
-
- /**
- * @brief Set background color for the view. The background will be filled with this color.
- * @SINCE_1_0.0
- * @param[in] color The background color.
- */
- void SetBackgroundColor( const Vector4& color );
-
- /**
- * @brief Get the background color.
- * @SINCE_1_0.0
- * @return The background color.
- */
- Vector4 GetBackgroundColor() const;
-
-public: // Signals
- /**
- * @brief If ActivateOnce has been called, then connect to this signal to be notified when the
- * target actor has been rendered.
- * @SINCE_1_0.0
- * @return The Finished signal
- */
- GaussianBlurViewSignal& FinishedSignal();
-
-public:
-
- /**
- * @brief Creates a handle using the Toolkit::Internal implementation.
- * @SINCE_1_0.0
- * @param[in] implementation The UI Control implementation.
- */
- DALI_INTERNAL GaussianBlurView( Internal::GaussianBlurView& implementation );
-
- /**
- * @brief Allows the creation of this UI Control from an Internal::CustomActor pointer.
- * @SINCE_1_0.0
- * @param[in] internal A pointer to the internal CustomActor.
- */
- DALI_INTERNAL GaussianBlurView( Dali::Internal::CustomActor* internal );
-
-};
-
-/**
- * @}
- */
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_GAUSSIAN_BLUR_EFFECT_H__
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL ImageView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL Model3dView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
* @SINCE_1_0.0
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL PageTurnLandscapeView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
} // namespace Toolkit
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
* @SINCE_1_1.4
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL PageTurnPortraitView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
} // namespace Toolkit
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
* @SINCE_1_1.4
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL PageTurnView(Dali::Internal::CustomActor* internal);
+ /// @endcond
};
} // namespace Toolkit
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
* @SINCE_1_0.0
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL ScrollBar( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL ItemView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief This constructor is used by Dali New() methods.
*
* @param [in] impl A pointer to a newly allocated Dali resource
*/
explicit DALI_INTERNAL ScrollViewEffect(Internal::ScrollViewEffect *impl);
+ /// @endcond
};
protected:
+ /// @cond internal
/**
* @brief This constructor is used by Dali New() methods.
* @SINCE_1_0.0
* @param [in] impl A pointer to a newly allocated Dali resource
*/
explicit DALI_INTERNAL ScrollViewPagePathEffect( Internal::ScrollViewPagePathEffect *impl );
+ /// @endcond
};
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL ScrollView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL Scrollable( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
+ *
* @SINCE_1_1.39
* @param[in] implementation The Control implementation
*/
/**
* @brief Allows the creation of this Control from an Internal::CustomActor pointer.
+ *
* @SINCE_1_1.39
* @param[in] internal A pointer to the internal CustomActor
*/
explicit DALI_INTERNAL Slider( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
* @SINCE_1_0.0
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL TableView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
return Dali::Toolkit::GetImpl( *this ).TextChangedSignal();
}
+TextEditor::InputStyleChangedSignalType& TextEditor::InputStyleChangedSignal()
+{
+ return Dali::Toolkit::GetImpl( *this ).InputStyleChangedSignal();
+}
+
TextEditor::TextEditor( Internal::TextEditor& implementation )
: Control( implementation )
{
* @brief A control which provides a multi-line editable text editor.
*
* * Signals
- * | %Signal Name | Method |
- * |----------------------|-----------------------------------------------------|
- * | textChanged | @ref TextChangedSignal() |
+ * | %Signal Name | Method | |
+ * |----------------------|--------------------------------|--------------------|
+ * | textChanged | @ref TextChangedSignal() | @SINCE_1_1.37 |
+ * | inputStyleChanged | @ref InputStyleChangedSignal() | @SINCE_1_2_2 |
*
*/
class DALI_IMPORT_API TextEditor : public Control
/**
* @brief The start and end property ranges for this control.
+ * @SINCE_1_1.37
*/
enum PropertyRange
{
/**
* @brief An enumeration of properties belonging to the TextEditor class.
+ * @SINCE_1_1.37
*/
struct Property
{
};
};
+ /**
+ * @brief Mask used by the signal InputStyleChangedSignal(). Notifies which parameters of the input style have changed.
+ *
+ * @SINCE_1_2_2
+ */
+ struct InputStyle
+ {
+ enum Mask
+ {
+ NONE = 0x0000, ///< @SINCE_1_2_2
+ COLOR = 0x0001, ///< @SINCE_1_2_2
+ FONT_FAMILY = 0x0002, ///< @SINCE_1_2_2
+ POINT_SIZE = 0x0004, ///< @SINCE_1_2_2
+ FONT_STYLE = 0x0008, ///< @SINCE_1_2_2
+ LINE_SPACING = 0x0010, ///< @SINCE_1_2_2
+ UNDERLINE = 0x0020, ///< @SINCE_1_2_2
+ SHADOW = 0x0040, ///< @SINCE_1_2_2
+ EMBOSS = 0x0080, ///< @SINCE_1_2_2
+ OUTLINE = 0x0100 ///< @SINCE_1_2_2
+ };
+ };
+
// Type Defs
- /// @brief Text changed signal type.
+ /**
+ * @brief Text changed signal type.
+ * @SINCE_1_1.37
+ */
typedef Signal<void ( TextEditor ) > TextChangedSignalType;
+ /**
+ * @brief Input Style changed signal type.
+ * @SINCE_1_2_2
+ */
+ typedef Signal<void ( TextEditor, InputStyle::Mask ) > InputStyleChangedSignalType;
+
/**
* @brief Create the TextEditor control.
+ *
+ * @SINCE_1_1.37
* @return A handle to the TextEditor control.
*/
static TextEditor New();
/**
* @brief Creates an empty handle.
+ *
+ * @SINCE_1_1.37
*/
TextEditor();
/**
* @brief Copy constructor.
*
+ * @SINCE_1_1.37
* @param[in] handle The handle to copy from.
*/
TextEditor( const TextEditor& handle );
/**
* @brief Assignment operator.
*
+ * @SINCE_1_1.37
* @param[in] handle The handle to copy from.
* @return A reference to this.
*/
* @brief Destructor.
*
* This is non-virtual since derived Handle types must not contain data or virtual methods.
+ * @SINCE_1_1.37
*/
~TextEditor();
* If the BaseHandle points is a TextEditor the downcast returns a valid handle.
* If not the returned handle is left empty.
*
+ * @SINCE_1_1.37
* @param[in] handle Handle to an object.
* @return handle to a TextEditor or an empty handle.
*/
* @code
* void YourCallbackName( TextEditor textEditor );
* @endcode
+ *
+ * @SINCE_1_1.37
* @return The signal to connect to.
*/
TextChangedSignalType& TextChangedSignal();
+ /**
+ * @brief This signal is emitted when the input style is updated as a consequence of a change in the cursor position.
+ * i.e. The signal is not emitted when the input style is updated through the property system.
+ *
+ * A callback of the following type may be connected. The @p mask parameter notifies which parts of the style have changed.
+ * @code
+ * void YourCallbackName( TextEditor textEditor, TextEditor::InputStyle::Mask mask );
+ * @endcode
+ *
+ * @SINCE_1_2_2
+ * @return The signal to connect to.
+ */
+ InputStyleChangedSignalType& InputStyleChangedSignal();
+
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
+ * @SINCE_1_1.37
* @param[in] implementation The Control implementation.
*/
DALI_INTERNAL TextEditor( Internal::TextEditor& implementation );
/**
* @brief Allows the creation of this Control from an Internal::CustomActor pointer.
*
+ * @SINCE_1_1.37
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL TextEditor( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
/*
- * 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.
return Dali::Toolkit::GetImpl( *this ).MaxLengthReachedSignal();
}
+TextField::InputStyleChangedSignalType& TextField::InputStyleChangedSignal()
+{
+ return Dali::Toolkit::GetImpl( *this ).InputStyleChangedSignal();
+}
+
TextField::TextField( Internal::TextField& implementation )
: Control(implementation)
{
#define __DALI_TOOLKIT_TEXT_FIELD_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.
* @brief A control which provides a single-line editable text field.
*
* * Signals
- * | %Signal Name | Method |
- * |----------------------|-----------------------------------------------------|
- * | textChanged | @ref TextChangedSignal() |
- * | maxLengthReached | @ref MaxLengthReachedSignal() |
- *
- * @SINCE_1_0.0
+ * | %Signal Name | Method | |
+ * |----------------------|--------------------------------|--------------------|
+ * | textChanged | @ref TextChangedSignal() | @SINCE_1_0.0 |
+ * | maxLengthReached | @ref MaxLengthReachedSignal() | @SINCE_1_0.0 |
+ * | inputStyleChanged | @ref InputStyleChangedSignal() | @SINCE_1_2_2 |
*/
class DALI_IMPORT_API TextField : public Control
{
EXCEED_POLICY_CLIP ///< The end of text will be clipped to fit within the TextField. @SINCE_1_0.0
};
+ /**
+ * @brief Mask used by the signal InputStyleChangedSignal(). Notifies which parameters of the input style have changed.
+ *
+ * @SINCE_1_2_2
+ */
+ struct InputStyle
+ {
+ enum Mask
+ {
+ NONE = 0x0000, ///< @SINCE_1_2_2
+ COLOR = 0x0001, ///< @SINCE_1_2_2
+ FONT_FAMILY = 0x0002, ///< @SINCE_1_2_2
+ POINT_SIZE = 0x0004, ///< @SINCE_1_2_2
+ FONT_STYLE = 0x0008, ///< @SINCE_1_2_2
+ UNDERLINE = 0x0010, ///< @SINCE_1_2_2
+ SHADOW = 0x0020, ///< @SINCE_1_2_2
+ EMBOSS = 0x0040, ///< @SINCE_1_2_2
+ OUTLINE = 0x0080 ///< @SINCE_1_2_2
+ };
+ };
+
// Type Defs
- /// @brief Text changed signal type.
+ /**
+ * @brief Text changed signal type.
+ * @SINCE_1_0.0
+ */
typedef Signal<void ( TextField ) > TextChangedSignalType;
- /// @brief Max Characters Exceed signal type.
+
+ /**
+ * @brief Max Characters Exceed signal type.
+ * @SINCE_1_0.0
+ */
typedef Signal<void ( TextField ) > MaxLengthReachedSignalType;
+ /**
+ * @brief Input Style changed signal type.
+ * @SINCE_1_2_2
+ */
+ typedef Signal<void ( TextField, InputStyle::Mask ) > InputStyleChangedSignalType;
+
/**
* @brief Create the TextField control.
* @SINCE_1_0.0
*/
MaxLengthReachedSignalType& MaxLengthReachedSignal();
+ /**
+ * @brief This signal is emitted when the input style is updated as a consequence of a change in the cursor position.
+ * i.e. The signal is not emitted when the input style is updated through the property system.
+ *
+ * A callback of the following type may be connected. The @p mask parameter notifies which parts of the style have changed.
+ * @code
+ * void YourCallbackName( TextField textField, TextField::InputStyle::Mask mask );
+ * @endcode
+ *
+ * @SINCE_1_2_2
+ * @return The signal to connect to.
+ */
+ InputStyleChangedSignalType& InputStyleChangedSignal();
+
public: // Not intended for application developers
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
explicit DALI_INTERNAL TextLabel( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
/**
public: // Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a handle using the Toolkit::Internal implementation.
*
* @param[in] internal A pointer to the internal CustomActor.
*/
DALI_INTERNAL VideoView( Dali::Internal::CustomActor* internal );
+ /// @endcond
};
{
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
-const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 45;
+const unsigned int TOOLKIT_MINOR_VERSION = 2;
+const unsigned int TOOLKIT_MICRO_VERSION = 5;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
$(public_api_src_dir)/controls/buttons/check-box-button.cpp \
$(public_api_src_dir)/controls/buttons/push-button.cpp \
$(public_api_src_dir)/controls/buttons/radio-button.cpp \
- $(public_api_src_dir)/controls/default-controls/solid-color-actor.cpp \
$(public_api_src_dir)/controls/flex-container/flex-container.cpp \
$(public_api_src_dir)/controls/image-view/image-view.cpp \
$(public_api_src_dir)/controls/model3d-view/model3d-view.cpp \
$(public_api_src_dir)/controls/text-controls/text-editor.cpp \
$(public_api_src_dir)/controls/text-controls/text-label.cpp \
$(public_api_src_dir)/controls/text-controls/text-field.cpp \
- $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \
$(public_api_src_dir)/styling/style-manager.cpp \
$(public_api_src_dir)/accessibility-manager/accessibility-manager.cpp \
$(public_api_src_dir)/focus-manager/keyboard-focus-manager.cpp \
$(public_api_src_dir)/controls/buttons/push-button.h \
$(public_api_src_dir)/controls/buttons/radio-button.h
-public_api_default_controls_header_files = \
- $(public_api_src_dir)/controls/default-controls/solid-color-actor.h
-
public_api_model3d_view_header_files = \
$(public_api_src_dir)/controls/model3d-view/model3d-view.h
public_api_flex_container_header_files = \
$(public_api_src_dir)/controls/flex-container/flex-container.h
-public_api_gaussian_blur_view_header_files = \
- $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.h
-
public_api_image_view_header_files = \
$(public_api_src_dir)/controls/image-view/image-view.h
$(public_api_src_dir)/controls/video-view/video-view.h
public_api_visuals_header_files = \
- $(public_api_src_dir)/visuals/batch-image-visual-properties.h \
$(public_api_src_dir)/visuals/border-visual-properties.h \
$(public_api_src_dir)/visuals/color-visual-properties.h \
$(public_api_src_dir)/visuals/gradient-visual-properties.h \
// Not intended for application developers
+ /// @cond internal
/**
* @brief Creates a new handle from the implementation.
*
* @param[in] impl A pointer to the object.
*/
explicit DALI_INTERNAL KeyboardFocusManager(Internal::KeyboardFocusManager *impl);
+ /// @endcond
}; // class KeyboardFocusManager
* If the application wants to customize the theme, RequestThemeChange
* needs to be called.
*
+ * To supply resource paths ( in json ) the following constant is available: APPLICATION_RESOURCE_PATH.
+ * It provides the path to the application resource root folder, from there the filename can an be specified along with
+ * any sub folders, e.g Images, Models etc.
+ * The APPLICATION_RESOURCE_PATH can be retrieved using Application::GetResourcePath()
+ *
* Signals
* | %Signal Name | Method |
* |------------------------------------------------------------|
*
* @SINCE_1_1.32
* @param[in] themeFile If a relative path is specified, then this is relative
- * to the directory returned by app_get_resource_path().
+ * to the directory returned by Application::GetResourcePath().
*/
void ApplyTheme( const std::string& themeFile );
* @param[in] control The control to which to apply the style.
* @param[in] jsonFileName The name of the JSON style file to apply. If a
* relative path is specified, then this is relative to the directory
- * returned by app_get_resource_path().
+ * returned by Application::GetResourcePath().
* @param[in] styleName The name of the style within the JSON file to apply.
*/
void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName );
public:
+ /// @cond internal
/**
* @brief Allows the creation of a StyleManager handle from an internal pointer.
*
* @param[in] impl A pointer to the object.
*/
explicit DALI_INTERNAL StyleManager( Internal::StyleManager *impl );
+ /// @endcond
}; // class StyleManager
+++ /dev/null
-#ifndef DALI_TOOLKIT_BATCH_IMAGE_VISUAL_PROPERTIES_H
-#define DALI_TOOLKIT_BATCH_IMAGE_VISUAL_PROPERTIES_H
-
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace BatchImageVisual
-{
-
-namespace Property
-{
-
-enum
-{
- /**
- * @brief The URL of the image.
- * @details Name "url", type Property::STRING.
- * @SINCE_1_1.46
- * @note Mandatory.
- */
- URL = VISUAL_PROPERTY_START_INDEX,
-
- /**
- * @brief The image width.
- * @details Name "desiredWidth", type Property::INTEGER.
- * @SINCE_1_1.46
- * @note Optional. If not specified, the actual image width is used.
- */
- DESIRED_WIDTH,
-
- /**
- * @brief The image height.
- * @details Name "desiredHeight", type Property::INTEGER.
- * @SINCE_1_1.46
- * @note Optional. If not specified, the actual image height is used.
- */
- DESIRED_HEIGHT,
-};
-
-} // namespace Property
-
-} // namespace BatchImageVisual
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_BATCH_IMAGE_VISUAL_PROPERTIES_H
* @note For N-Patch images only.
*/
BORDER_ONLY,
+
+ /**
+ * @brief This enables Image visuals to automatically be converted to Batch-Image visuals.
+ * @details Name "batchingEnabled", type Property::BOOLEAN.
+ * @SINCE_1_2.0
+ * @note Optional. If not specified, the default is false.
+ * @note For Image visuals only. Not to be used with NPatch or SVG images.
+ */
+ BATCHING_ENABLED,
+
+ /**
+ * @brief The image area to be displayed.
+ * @details Name "pixelArea", type Property::VECTOR4.
+ * It is a rectangular area.
+ * The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.
+ * @SINCE_1_2.1
+ * @note Optional. If not specified, the default value is [0.0, 0.0, 1.0, 1.0], i.e. the entire area of the image.
+ * @note For Normal Quad images only.
+ */
+ PIXEL_AREA,
+
+ /**
+ * @brief The wrap mode for u coordinate.
+ * @details Name "wrapModeU", type Dali::WrapMode::Type (Property::INTEGER) or Property::STRING
+ * It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.
+ * @SINCE_1_2.1
+ * @note Optional. If not specified, the default is CLAMP.
+ * @note For Normal QUAD image only.
+ */
+ WRAP_MODE_U,
+
+ /**
+ * @brief The wrap mode for v coordinate.
+ * @details Name "wrapModeV", type Dali::WrapMode::Type (Property::INTEGER) or Property::STRING
+ * it decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.
+ * @SINCE_1_2.1
+ * @note Optional. If not specified, the default is CLAMP.
+ * @note For Normal QUAD image only.
+ */
+ WRAP_MODE_V,
};
} // namespace Property
/**
* @brief The color of the shape.
- * @details Name "shapeColor", type Property::VECTOR4.
- * @SINCE_1_1.45
+ * @details Name "mixColor", type Property::VECTOR4.
+ * @SINCE_1_2_4
* @note Optional. If not specified, the default is Vector4(0.5, 0.5, 0.5, 1.0).
* @note Applies to ALL shapes.
*/
- COLOR,
+ MIX_COLOR,
/**
* @brief The number of slices as you go around the shape.
IMAGE, ///< Renders an image into the control's quad. @SINCE_1_1.45
MESH, ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45
PRIMITIVE, ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45
- DEBUG, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_1.45
- BATCH_IMAGE, ///< Renders an image in the geometry batching mode @SINCE_1_1.46
+ WIREFRAME, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2_2
};
namespace Property
* @see Shader::Property
*/
SHADER,
-
- /**
- * @brief This enables Image visuals to automatically be converted to Batch-Image visuals.
- * @details Name "batchingEnabled", type Boolean.
- * @SINCE_1_1.46
- * @note Optional.
- */
- BATCHING_ENABLED,
};
} // namespace Property
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * This file is part of Dali Toolkit
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+//******************************************************************************
+//
+// Default Reference style theme for a 1920x1080 resolution, The values determined by UX design specification.
+// This file can be copied to a new folder within the styles/ directory and amended with new default values.
+// Can be overriden if StyleManager applies another style sheet.
+//
+//******************************************************************************
+
+{
+ "styles":
+ {
+ "TextLabel":
+ {
+ "pointSize":108,
+ "enableAutoScroll":false,
+ "autoScrollLoopCount":2,
+ "autoScrollGap":50,
+ "autoScrollSpeed":80
+ },
+
+ "TextLabelFontSize0":
+ {
+ "pointSize":84
+ },
+ "TextLabelFontSize1":
+ {
+ "pointSize":96
+ },
+ "TextLabelFontSize2":
+ {
+ "pointSize":108
+ },
+ "TextLabelFontSize3":
+ {
+ "pointSize":120
+ },
+ "TextLabelFontSize4":
+ {
+ "pointSize":132
+ },
+
+ "TextField":
+ {
+ "pointSize":120,
+ "primaryCursorColor":[0.0,0.72,0.9,1.0],
+ "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+ "cursorWidth":6,
+ "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+ "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+ "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+ "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+ },
+
+ "TextFieldFontSize0":
+ {
+ "pointSize":120
+ },
+ "TextFieldFontSize1":
+ {
+ "pointSize":120
+ },
+ "TextFieldFontSize2":
+ {
+ "pointSize":120
+ },
+ "TextFieldFontSize3":
+ {
+ "pointSize":120
+ },
+ "TextFieldFontSize4":
+ {
+ "pointSize":120
+ },
+ "TextSelectionPopup":
+ {
+ "popupMaxSize":[1700,100],
+ "optionDividerSize":[2,0],
+ "popupDividerColor":[0.23,0.72,0.8,0.11],
+ "popupIconColor":[1.0,1.0,1.0,1.0],
+ "popupPressedColor":[0.24,0.72,0.8,0.11],
+ "background": {
+ "rendererType": "image",
+ "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+ },
+ "popupFadeInDuration":0.25,
+ "popupFadeOutDuration":0.25
+ },
+ "TextSelectionPopupButton":
+ {
+ "label":
+ {
+ "pointSize":120,
+ "fontStyle":"{\"weight\":\"light\"}"
+ }
+ },
+ "TextSelectionToolbar":
+ {
+ "enableOvershoot":true,
+ "scrollView":
+ {
+ "overshootAnimationSpeed":360.0,
+ "overshootSize":[1920.0,130.0]
+ }
+ },
+ "ScrollView":
+ {
+ "overshootEffectColor":"B018",
+ "overshootAnimationSpeed":960.0,
+ "overshootSize":[1920.0,130.0]
+ },
+ "ItemView":
+ {
+ "overshootEffectColor":"B018",
+ "overshootAnimationSpeed":960.0,
+ "overshootSize":[1920.0,130.0]
+ },
+ "TextEditor":
+ {
+ "pointSize":120,
+ "primaryCursorColor":[0.0,0.72,0.9,1.0],
+ "secondaryCursorColor":[0.0,0.72,0.9,1.0],
+ "cursorWidth":6,
+ "selectionHighlightColor":[0.75,0.96,1.0,1.0],
+ "grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
+ "selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
+ "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+ },
+ "ProgressBar":
+ {
+ "progressValue": 0,
+ "trackVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "size":[24,24]
+ },
+ "progressVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "size":[24,24]
+ }
+ },
+ "ProgressBarValueTextLabel":
+ {
+ "textColor":[0.8,0.8,1,1]
+ }
+ }
+}
{
"styles":
{
- "textlabel":
+ "TextLabel":
{
"pointSize":18,
"enableAutoScroll":false,
"autoScrollSpeed":80
},
- "textlabelFontSize0":
+ "TextLabelFontSize0":
{
"pointSize":8
},
- "textlabelFontSize1":
+ "TextLabelFontSize1":
{
"pointSize":10
},
- "textlabelFontSize2":
+ "TextLabelFontSize2":
{
"pointSize":15
},
- "textlabelFontSize3":
+ "TextLabelFontSize3":
{
"pointSize":19
},
- "textlabelFontSize4":
+ "TextLabelFontSize4":
{
"pointSize":25
},
+ "RadioButton":
+ {
+ "unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
+ "selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
+ "disabledUnselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected-disabled.png",
+ "disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
+ },
- "textfield":
+ "TextField":
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
- "textfieldFontSize0":
+ "TextFieldFontSize0":
{
"pointSize":10
},
- "textfieldFontSize1":
+ "TextFieldFontSize1":
{
"pointSize":10
},
- "textfieldFontSize2":
+ "TextFieldFontSize2":
{
"pointSize":10
},
- "textfieldFontSize3":
+ "TextFieldFontSize3":
{
"pointSize":10
},
- "textfieldFontSize4":
+ "TextFieldFontSize4":
{
"pointSize":10
},
- "textselectionpopup":
+ "TextSelectionPopup":
{
"popupMaxSize":[400,100],
"optionDividerSize":[2,0],
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
- "textselectionpopupbutton":
+ "TextSelectionPopupButton":
{
"label":
{
"fontStyle":"{\"weight\":\"light\"}"
}
},
- "textselectiontoolbar":
+ "TextSelectionToolbar":
{
"enableOvershoot":true,
"scrollView":
"overshootSize":[480.0,42.0]
}
},
- "scrollview":
+ "ScrollView":
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
- "itemview":
+ "ItemView":
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":120.0,
"overshootSize":[480.0,42.0]
},
- "texteditor":
+ "TextEditor":
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
- "popup":
+ "Popup":
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
},
- "confirmationpopup":
+ "ConfirmationPopup":
{
"popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ },
+ "Slider":
+ {
+ "showPopup": true,
+ "showValue": true,
+ "valuePrecision": 0,
+ "trackVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "size":[27,27]
+ },
+ "progressVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "size":[27,27]
+ },
+ "handleVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin-handle.png",
+ "size":[72,72]
+ },
+ "popupVisual":"{DALI_IMAGE_DIR}slider-popup.9.png",
+ "popupArrowVisual":"{DALI_IMAGE_DIR}slider-popup-arrow.9.png",
+ "disableColor":[0.5, 0.5, 0.5, 1.0],
+ "popupTextColor":[0.5,0.5,0.5,1.0],
+ "hitRegion":[0, 72],
+ "marks":[],
+ "snapToMarks":false,
+ "markTolerance":0.05
+ },
+ "SliderHandleTextLabel":
+ {
+ "textColor":[0.8,0.8,1,1]
+ },
+ "ProgressBar":
+ {
+ "progressValue": 0,
+ "trackVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "size":[24,24]
+ },
+ "progressVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "size":[24,24]
+ }
+ },
+ "ProgressBarValueTextLabel":
+ {
+ "textColor":[0.8,0.8,1,1]
}
}
}
{
"styles":
{
- "textlabel":
+ "TextLabel":
{
"pointSize":18,
"enableAutoScroll":false,
"autoScrollSpeed":80
},
- "textlabelFontSize0":
+ "TextLabelFontSize0":
{
"pointSize":8
},
- "textlabelFontSize1":
+ "TextLabelFontSize1":
{
"pointSize":10
},
- "textlabelFontSize2":
+ "TextLabelFontSize2":
{
"pointSize":15
},
- "textlabelFontSize3":
+ "TextLabelFontSize3":
{
"pointSize":19
},
- "textlabelFontSize4":
+ "TextLabelFontSize4":
{
"pointSize":25
},
+ "RadioButton":
+ {
+ "unselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected.png",
+ "selectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected.png",
+ "disabledUnselectedStateImage":"{DALI_IMAGE_DIR}radio-button-unselected-disabled.png",
+ "disabledSelectedStateImage":"{DALI_IMAGE_DIR}radio-button-selected-disabled.png"
+ },
- "textfield":
+ "TextField":
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
},
- "textfieldFontSize0":
+ "TextFieldFontSize0":
{
"pointSize":10
},
- "textfieldFontSize1":
+ "TextFieldFontSize1":
{
"pointSize":10
},
- "textfieldFontSize2":
+ "TextFieldFontSize2":
{
"pointSize":10
},
- "textfieldFontSize3":
+ "TextFieldFontSize3":
{
"pointSize":10
},
- "textfieldFontSize4":
+ "TextFieldFontSize4":
{
"pointSize":10
},
- "textselectionpopup":
+ "TextSelectionPopup":
{
"popupMaxSize":[656,72],
"optionDividerSize":[2,0],
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
- "textselectionpopupbutton":
+ "TextSelectionPopupButton":
{
"label":
{
"fontStyle":"{\"weight\":\"light\"}"
}
},
- "textselectiontoolbar":
+ "TextSelectionToolbar":
{
"enableOvershoot":true,
"scrollView":
"overshootSize":[720.0,130.0]
}
},
- "scrollview":
+ "ScrollView":
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":360.0,
"overshootSize":[720.0,130.0]
},
- "itemview":
+ "ItemView":
{
"overshootEffectColor":"B018",
"overshootAnimationSpeed":360.0,
"overshootSize":[720.0,130.0]
},
- "texteditor":
+ "TextEditor":
{
"pointSize":18,
"primaryCursorColor":[0.0,0.72,0.9,1.0],
"grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+ },
+ "Popup":
+ {
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ },
+ "ConfirmationPopup":
+ {
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ },
+ "Slider":
+ {
+ "showPopup": true,
+ "showValue": true,
+ "valuePrecision": 0,
+ "trackVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "size":[27,27]
+ },
+ "progressVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "size":[27,27]
+ },
+ "handleVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin-handle.png",
+ "size":[72,72]
+ },
+ "popupVisual":"{DALI_IMAGE_DIR}slider-popup.9.png",
+ "popupArrowVisual":"{DALI_IMAGE_DIR}slider-popup-arrow.9.png",
+ "disableColor":[0.5, 0.5, 0.5, 1.0],
+ "popupTextColor":[0.5,0.5,0.5,1.0],
+ "hitRegion":[0, 72],
+ "marks":[],
+ "snapToMarks":false,
+ "markTolerance":0.05
+ },
+ "SliderHandleTextLabel":
+ {
+ "textColor":[0.8,0.8,1,1]
+ },
+ "ProgressBar":
+ {
+ "progressValue": 0,
+ "trackVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin.9.png",
+ "size":[24,24]
+ },
+ "progressVisual":{
+ "url":"{DALI_IMAGE_DIR}slider-skin-progress.9.png",
+ "size":[24,24]
+ }
+ },
+ "ProgressBarValueTextLabel":
+ {
+ "textColor":[0.8,0.8,1,1]
}
}
}
* </tr>
* <tr>
* <td style="padding-left:1em">@ref dali_toolkit_controls_scroll_bar</td>
- * <td>ScrollBar control.</td>
+ * <td>ScrollBar is a component that can be linked to the scrollable objects.</td>
* </tr>
* <tr>
* <td style="padding-left:1em">@ref dali_toolkit_controls_scrollable</td>
- * <td>Scrollable container controls.</td>
+ * <td>Scrollable contains scrolled controls.</td>
* </tr>
* <tr>
* <td style="padding-left:2em">@ref dali_toolkit_controls_item_view</td>
* @brief ImageView is a control displying an image.
* @defgroup dali_toolkit_controls_scroll_bar Scroll Bar
- * @brief ScrollBar control.
+ * @brief ScrollBar is a component that can be linked to the scrollable objects.
* @defgroup dali_toolkit_controls_scrollable Scrollable
- * @brief Scrollable container controls.
+ * @brief Scrollable contains scrolled controls.
* @{
* @defgroup dali_toolkit_controls_item_view Item View
+ Environment Variables
+ [Resource Tracking](@ref resourcetracking)
+ Logging
- + [Debug Visual](@ref debugvisual)
+ + [Visual Debug Rendering](@ref debugrendering)
+ [Stagehand - DALi Visual Debugger](@ref stagehand)
### Viewing Modes
This means that C++ new/delete operators do not have to be used (or paired) in the user code (RAII idiom).
Of course there's no way of stopping users from allocating heap memory, but calls to the new operator can be minimised.
-<h2 class="pg">What does 'implicit smart-pointer semantics' mean in the case of Dali?</h2>
+<h2 class="pg">What does 'implicit smart-pointer semantics' mean in the case of DALi?</h2>
Since DALi objects are just handles, they can be copied by value. When a DALi object is copied, both the copy and original will point to the same DALi resource.
The internal DALi resources are reference counted; copying a DALi object will increase the reference count. A resource will not be deleted until all its Dali::Object handles are destroyed, or reset.
- returned from functions
*/
-
/*! \page hello-world Hello World - explained
-The following steps are required for displaying the sentence 'Hello World' with Dali:
+The following steps are required for displaying the sentence 'Hello World' with DALi:
- initialize the DALi library
- create an Actor showing text
* The Image View is constructed by passing a Dali::Image object or by a url path.<br>
*
* <h3 class="pg">Loading from a url path</h3>
- * Image View will load a file from a given url path. Using a url path is the prefered way of displaying an image as the Dali engine can do optimsations to
+ * Image View will load a file from a given url path. Using a url path is the prefered way of displaying an image as the DALi engine can do optimisations to
* reuse shaders and perform automatic image atlassing.<br>
* This can be a path to a image file:
* @code
Properties can be set externally by an application, allowing that application to change the configuration or behaviour of an actor.
This could include the physical geometry of the actor, or how it is drawn or moves.
-Properties can also be read. This feature can be used in conjunction with constraints to allow changes to a property within one actor to cause changes to the property of another actor. For example, an actor following the movement of another separate actor (that it is not a child of).
+Properties can also be read. This feature can be used in conjunction with constraints to allow changes to a property within one actor to cause changes to the property of another actor. For example, an actor following the movement of another separate actor (that it is not a child of).
Properties can be used to expose any useful information or behaviour of an actor.
Other actor variables that are used to implement this bevahiour, or do not make useful sense from an application developers point of view should not be exposed.
-<h2 class="pg">How to implement a property within Dali-core:</h2>
+<h2 class="pg">How to implement a property within DALi Core:</h2>
<b>There are two stages:</b>
- The parameter to DALI_PROPERTY_TABLE_END should match the start index of the property enumeration.
<br>
-<h2 class="pg">How to implement a property within Dali-toolkit controls and application-side custom controls:</h2>
+<h2 class="pg">How to implement a property within DALi Toolkit controls and application-side custom controls:</h2>
Macros are used to define properties for the following reasons:
Images for that style should be in their own folder named images.
Common images not specific for a particular style will be in the images-common folder located in the style folder.
+
+All application resources are stored in a defined path (application resource path), from this path sub directories can be specified.
+
+The application resource path can be retrieved using Application::GetResourcePath()
+
+Alternatively to supply resource paths in json the following constant is available: APPLICATION_RESOURCE_PATH.
+
+It provides the path to the application resource root folder, from there the filename can an be specified along with any sub folders, e.g Images, Models etc.
+
+
*
*/
Accessibility describes functionality designed to aid usage by the visually impaired.
This includes:
-- Reading out selections or other on-screen items via text-to-speach.
+- Reading out selections or other on-screen items via text-to-speech.
- Item selection being controlled with gestures to aid selecting other small hard to select entities.
DALi will pick up the system's current accessibility state (and subsequent changes to it) and enable its internal accessibility mode based on this.
-DALi includes an Accessibility Manager which prodives public API control of the order of object selection by gesture, and text to be read out per actor or control.
+DALi includes an Accessibility Manager which provides public API control of the order of object selection by gesture, and text to be read out per actor or control.
It further provides many signals that represent accessibility gestures. These gestures can range from a simple actor selection through to a more control-specific concept like "page-up", which an application developer may want to provide an implementation for.
 
</div>
-Visibily, when enabled, accessibility will typically show an actor (or actors) as focused. This is represented by default with yellow rectangular frame around the actor. See this section for [modifying the appearance of the accessibility focus](#accessibilityfocusappearance).
+Visibly, when enabled, accessibility will typically show an actor (or actors) as focused. This is represented by default with yellow rectangular frame around the actor. See this section for [modifying the appearance of the accessibility focus](#accessibilityfocusappearance).
Once in accessibility mode, normal control is disabled and accessibility gestures must be used to access content.
DALi actors and controls will no longer receive tap gestures or click events when they are touched once (as they normally would).
-Note: The accessibility focus is also refered to as the Focus Indicator.
+Note: The accessibility focus is also referred to as the Focus Indicator.
### Moving the focus with gestures {#accessibilitygestures}
-Accessibility recognises many gesture types to move the accessibility focus from actor to actor.
+Accessibility recognizes many gesture types to move the accessibility focus from actor to actor.
Note:
Activation describes an operation performed on a selected actor, typically an on-tap or on-click event.
Activating an actor in accessibility mode will call a virtual function, as well as signal, for that actor.
-Depending on the platform this can br triggered in different ways.
+Depending on the platform this can be triggered in different ways.
When activated, the built in actor types (like PushButton) will do the equivalent of a tap.
Custom-built actor types will need to implement activation in order to perform a specific behaviour. See the [Custom Controls](#accessibilitycustomcontrol) section.
### Modifying the appearance of the accessibility focus {#accessibilityfocusappearance}
-The focus graphic itself can be customised.
+The focus graphic itself can be customized.
It can be an image (EG. A nine-patch border) or any other type of actor.
It can be set using this method within C++:
Wrap mode allows the focus to wrap back to the beginning once the end is reached.
-In group mode this will move to the beggining of the current focus group.
+In group mode this will move to the beginning of the current focus group.
~~~{.cpp}
AccessibilityManager accessibilityManager = AccessibilityManager::Get();
This example sets up a 3 by 3 grid of actors with the following accessibility functionality:
- They have a focus order that moves from top left to bottom right (when using the accessibility next and previous gestures).
- - They contain text that will be spoken out loud (via text-to-speach) when the focus changes.
+ - They contain text that will be spoken out loud (via text-to-speech) when the focus changes.
Note that all the above is set via the AccessibilityManager and not as properties within the actors.
// Set the focus order of this actor.
accessibilityManager.SetFocusOrder( tile, tileNumber );
- // Set up the accessibility information for this actor (this will be read out with text-to-speach).
+ // Set up the accessibility information for this actor (this will be read out with text-to-speech).
accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_LABEL, tileNames[tileNumber] );
accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_TRAIT, "Tile" );
accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_HINT, "You can run this example");
| Method | Description |
|----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| OnAccessibilityActivated | When the control is *activated* or selected, in accessibility mode. |
-| OnAccessibilityPan | When an accessibility pan gesture occurs while this control is focussed. |
+| OnAccessibilityPan | When an accessibility pan gesture occurs while this control is focused. |
| OnAccessibilityTouch | Touch events are delivered differently in Accessibility mode. This method should be overridden if some special behaviour is required when these touch events are received. |
-| OnAccessibilityValueChange | When a value is changed while this control is focussed (e.g. value change of a slider control). |
-| OnAccessibilityZoom | Should be overridden if behaviour is required when the magnification level changes when this control is focussed. |
+| OnAccessibilityValueChange | When a value is changed while this control is focused (e.g. value change of a slider control). |
+| OnAccessibilityZoom | Should be overridden if behaviour is required when the magnification level changes when this control is focused. |
If these events are consumed, then the method should return true.
The default behaviour in the control base classes returns false, i.e. not consumed.
For more specific control of functionality when accessibility is enabled, there are several signals within the accessibility manager's public API that can be connected to.
-The main catagories of signals are:
+The main categories of signals are:
- The signal when the accessibility status is detected as being toggled on or off: StatusChangedSignal()
- Focus changes can cause FocusChangedSignal() and FocusOvershotSignal(). These can be connected to in order to provide custom actions when the focus is moved around the screen.
### Animating Properties
-There are two distint ways in which properties can be animated within DALi:
+There are two distinct ways in which properties can be animated within DALi:
- **AnimateTo:** The property will animate **TO** the value in the given time.
- **AnimateBy:** The property will animate **BY** the value in the given time.
|[PASTE][CLIPBOARD] buttons shown| [CUT][COPY], [SELECT ALL] unless all text selected and [PASTE][CLIPBOARD] if content to paste. |
|   |   |
| Condition: Long press/double tap popup when text-control contains just whitespace | Condition: Empty text & clipboard empty |
-| Whitespace treated as regular text, [CUT][COPY] shown and [PASTE][CLIPBOARD] if content to paste. As all text is selected there is no need for [SELECT ALL] | No popup shown after longpress/double tap|
+| Whitespace treated as regular text, [CUT][COPY] shown and [PASTE][CLIPBOARD] if content to paste. As all text is selected there is no need for [SELECT ALL] | No popup shown after long press/double tap|
|   |  |
-| Condition: Longpress/(double tap) on whitespace which is following text | Condition: Tapping text or panning grab handle |
+| Condition: Long press/(double tap) on whitespace which is following text | Condition: Tapping text or panning grab handle |
| [PASTE][CLIPBOARD] shown if something to paste. [SELECT ALL] as more text to select | If content in clipboard [PASTE][CLIPBOARD] popup will be shown. |
|   |   |
+ A **hover event** is when a pointer moves within the bounds of a custom actor (e.g. mouse pointer or hover pointer).
+ A **wheel event** is when the mouse wheel (or similar) is moved while hovering over an actor (via a mouse pointer or hover pointer).
-If the control needs to utilise hover and wheel events, then the correct behaviour flag should be used when constructing the control and then the appropriate method should be overridden.
+If the control needs to utilize hover and wheel events, then the correct behaviour flag should be used when constructing the control and then the appropriate method should be overridden.
~~~{.cpp}
// C++
bool MyUIControlImpl::OnHoverEvent( const HoverEvent& event )
+ Provides Layers to aid in 2D UI layout
+ Easy to use Animation framework
+ Automatic background loading of resources ( images / text / meshes )
- + Runs all animations in a seperate thread. This helps maintain 60 FPS even if JavaScript is performing a long operation ( e.g. Garbage Collection ).
+ + Runs all animations in a separate thread. This helps maintain 60 FPS even if JavaScript is performing a long operation ( e.g. Garbage Collection ).
+ Provides keyboard / touch / mouse handling

--- /dev/null
+<!--
+/**-->
+
+# Debug rendering {#debugrendering}
+
+Setting DALI_DEBUG_RENDERING environment variable will enable the visual debugging.
+
+Then, every concrete visual ( ColorVisual, BorderVisual, ImageVisual, GradientVisual, etc. ) is replaced with a wireframe visual.
+The wireframe visual renders a simple quad wireframe, so that the control layout and scene structure is clearly displayed.
+
+## Example:
+~~~{.bash}
+sh-4.1$ DALI_DEBUG_RENDERING=1 /usr/apps/com.samsung.dali-demo/bin/blocks.example
+~~~
+
+
+
+
+
+++ /dev/null
-<!--
-/**-->
-
-# Debug Visual {#debugvisual}
-
-## Enable debug rendering
-
-Setting DALI_DEBUG_RENDERING environment variable will enable the visual debuging.
-
-Then, every concrete visual ( ColorVisual, BorderVisual, ImageVisual, GradientVisual, etc. ) is replaced with a DebugVisual object.
-Debug visual renders a simple quad wireframe, so that the control layout and scene structure is clearly displayed.
-
-### Example:
-~~~{.bash}
-sh-4.1$ DALI_DEBUG_RENDERING=1 /usr/apps/com.samsung.dali-demo/bin/blocks.example
-~~~
-
-
-
-
-
<!--
/**-->
-# Writing documentation for the DALi programing guide {#documentationguide}
+# Writing documentation for the DALi programming guide {#documentationguide}
To allow documentation to be shared between C++ and JavaScript, please follow these guidelines:
[Go To MyChapter](@ref my-chapter)
~~~
-Code blocks can be enclosed within 2 blocks of 3 tildas(~).
+Code blocks can be enclosed within 2 blocks of 3 tildes(~).
You can even specify your language type, for example:
~~~{.md}
Dali-Core can be built using with Emscripten producing a Javascript version of DALi.
A web page can then be made with HTML, and by embedding Javascript can reference and control the DALi Javascript canvas.
-This allows you to have a DALi canvas within a webpage that can either:
+This allows you to have a DALi canvas within a web page that can either:
- Run autonomously
-- Be controlled by HTML / Javascript controls elsewhere on the webpage
+- Be controlled by HTML / Javascript controls elsewhere on the web page
The necessary scripts for building are included within each DALi repository.
- Building dali-adaptor Emscripten replacement with a separate build script found in dali-adaptor
- Installing the examples within the dali-demo repository
-## Build Artefacts {#emscripten-artefacts}
+## Build Artifacts {#emscripten-artifacts}
-Each step in the build process will produce artefacts that will be written to the DALi environment directory.
+Each step in the build process will produce artifacts that will be written to the DALi environment directory.
- dali-core: Produces a dali-core.so in bytecode.
- dali-adaptor: Produces:
# Running The Live Unit Tests {#emscripten-tests}
Included are some live unit tests.
-These run as a webpage within a browser, a DALi canvas is created and used to run each test.
+These run as a web page within a browser, a DALi canvas is created and used to run each test.
The QUnit test suite is used (included within the repository for compatibility).
 
<br>
-For the tests to work correctly, the webpage should be run through a webserver, rather than directly with a browser.
+For the tests to work correctly, the web page should be run through a web server, rather than directly with a browser.
This can be achieved simply using npms's zero configuration command line server: "http-server".
To install "http-server":
flexContainer.Add( item1 );
Dali::Toolkit::Control item2 = Dali::Toolkit::Control::New();
-flexContainer.Add( item2 ); // item2 is aligned at the beginning of ther container
+flexContainer.Add( item2 ); // item2 is aligned at the beginning of the container
Dali::Toolkit::Control item3 = Dali::Toolkit::Control::New();
item3.SetProperty( Dali::Toolkit::FlexContainer::ChildProperty::ALIGN_SELF, Dali::Toolkit::FlexContainer::ALIGN_FLEX_END ); // Align item3 at the bottom of the container
flexContainer.Add( item3 );
Dali::Toolkit::Control item4 = Dali::Toolkit::Control::New();
-flexContainer.Add( item4 ); // item4 is aligned at the beginning of ther container
+flexContainer.Add( item4 ); // item4 is aligned at the beginning of the container
~~~
flexContainer.add(item1);
var item2 = new dali.Control();
-flexContainer.add(item2); // item2 is aligned at the beginning of ther container
+flexContainer.add(item2); // item2 is aligned at the beginning of the container
var item3 = new dali.Control();
item1.alignSelf = "flexEnd"; // Align item3 at the bottom of the container
flexContainer.add(item3);
var item4 = new dali.Control();
-flexContainer.add(item4); // item4 is aligned at the beginning of ther container
+flexContainer.add(item4); // item4 is aligned at the beginning of the container
~~~
___________________________________________________________________________________________________
### Font Styles
-Setting a font size programmatically is not ideal for applications which support multiple screen resolutions etc.
+Setting a font size programmatically is not ideal for applications which support multiple
+screen resolutions and platforms which support multiple logical font sizes. Also, any
+changes to the platform font settings will override any sizes that have been programmatically
+set.
+
A more flexible approach is to prepare various JSON stylesheets, and request a different style for each platform:
~~~{.cpp}
~~~
However the same pointSize is unlikely to be suitable for all text controls in an application.
-To set custom sizes simply set a "style name" for each case, and then provide a style override in JSON:
+To define custom styles for existing controls, simply set a style name for each case, and
+then provide a style override in JSON.
+
+To provide flexibility for the end user, the platform offers a mechanism to alter the logical
+font size between 0 and 4 inclusive. This logical size is mapped to a physical size using the
+stylesheets, by appending FontSizeN to the style name. These sections ("textlabelFontSizeN")
+in the style sheet are applied after the base section ("textlabel"), so take precedence.
~~~{.cpp}
// C++
~~~{.js}
// JavaScript
- label.styleName = "custom"';
+ label.styleName = "customLabel"';
~~~
~~~{.json}
{
"fontFamily":"FreeSerif",
"fontStyle":"{\"weight\":\"bold\",\"slant\":\"italic\"}",
+ },
+
+ "textlabelFontSize0":
+ {
"pointSize":8
},
+ "textlabelFontSize1":
+ {
+ "pointSize":10
+ },
+ "textlabelFontSize2":
+ {
+ "pointSize":15
+ },
+ "textlabelFontSize3":
+ {
+ "pointSize":19
+ },
+ "textlabelFontSize4":
+ {
+ "pointSize":25
+ },
- "custom":
+ "customLabel":
+ {
+ "fontFamily":"TimesNewRoman",
+ "fontStyle":"{\"weight\":\"regular\",\"slant\":\"regular\"}",
+ },
+ "customLabelFontSize0":
{
"pointSize":10
+ },
+ "customLabelFontSize1":
+ {
+ "pointSize":12
+ },
+ "customLabelFontSize2":
+ {
+ "pointSize":15
+ },
+ "customLabelFontSize3":
+ {
+ "pointSize":20
+ },
+ "customLabelFontSize4":
+ {
+ "pointSize":28
}
}
}
~~~
-In the example above, standard text labels will have pointSize 8, and "custom" labels will have pointSize 10.
+In the example above, at platform logical text size 0, standard text labels will have pointSize 8, and custom labels will have pointSize 10.
+
*/
## Actors and the Stage {#actors-and-stage}
Actor is the primary object with which DALi applications interact.
-A DALi application uses a hierachy of Dali::Actor objects to position visible content.
+A DALi application uses a hierarchy of Dali::Actor objects to position visible content.
An actor inherits a position relative to its parent, and can be moved relative to this point.
UI controls can be built by combining multiple actors.
## Scene Graph {#scene-graph}
-From wikipedia...
+From Wikipedia...
A scene graph is a collection of nodes in a graph or tree structure.
A node may have many children but often only a single parent,
### New property has been added
- No code change required.
-- It will be automatically avalable using the dot notation. E.g. actor.my_new_property = true;
+- It will be automatically available using the dot notation. E.g. actor.my_new_property = true;
### New property type has been added
- modify property-value-wrapper.h / .cpp to support the new type
### New function added to an object
- Add the function name to function table in my-object-wrapper.cpp
- Add the forwarding function to my-object-api.cpp/.h
-- Ensure you have created YUIDOC documention above the function
+- Ensure you have created YUIDOC documentation above the function


If Light inherits from Handle then use path-wrapper and path-api as a template to create light-wrapper and light-api
( inherits from HandleWrapper)
-Otherwise use animation-wrapper and animation-api as a template ( inherts from BaseWrappedObject)
+Otherwise use animation-wrapper and animation-api as a template ( inherits from BaseWrappedObject)
@class _Guide_JavaScript_Wrapping
-*/
\ No newline at end of file
+*/
+++-> Actor3 ( depth Index offset of 3000)
+++-> Actor4 ( depth Index offset of 3000)
+++-> Actor5 ( depth Index offset of 3000)
- +++-> Layer1 ( depth Index has no meaning for layers, layer draw order is independent of the heirachy).
+ +++-> Layer1 ( depth Index has no meaning for layers, layer draw order is independent of the hierarchy).
++++-> Actor6 ( depth Index offset of 4000)
++++-> Actor7 ( depth Index offset of 4000)
++++-> Actor8 ( depth Index offset of 4000)
### Layer Actor Specific Properties
-| Name | Type | Writeable | Animatable|
+| Name | Type | Writable | Animatable|
|------------------------|------------|--------------|-----------|
| clippingEnable |BOOLEAN | 0 | X |
| clippingBox | ARRAY [0,0,400,600]) | 0 | X|
dali.stage.add( field );
~~~
-Note the mark-up processor doesn't check the correctness of the mark-up string. This may cause the text to be badly rendered.
+Note the mark-up processor doesn't check the correctness of the mark-up string. This may
+cause the text to be badly rendered.
The table below describes the priorities when styles are applied while rendering text.
| | | | |
| Priority 2 | Style set through the control properties. | Will override the default platform style. | |
| Priority 3 | Default platform style. | | |
+Font size has slightly different priorities - the size provided by the platform is a logical
+size, and can be mapped to physical point sizes using style sheets. There is a default set of
+sizes defined for DALi, and these can be overridden by application specific stylesheets. Thus
+the priorities are:
+
+| | | |
+|--|--|--|
+| Priority 1 | Size set by markup string. | Will override the style set through the stylesheets. |
+| Priority 2 | Physical Size set by application style sheet | |
+| Priority 2 | Logical Size set by application style sheet | Mapping from platform logical to physical |
+| Priority 3 | Logical Size set by DALi style sheet | Mapping from platform logical to physical |
+
+See [Font Selection](@ref font-selection) for more details.
+
Current supported tags are:
## \<color\>
- Actors
- The final part of hit testing is performed by walking through the actor tree within a layer.
- - The following pseudocode shows the algorithm used:
+ - The following pseudo-code shows the algorithm used:
~~~
actor (and its parents). There will be NO touch signal delivery for the hit actors of the
other touch points.
- The local coordinates are from the top-left (0.0f, 0.0f, 0.5f) of the hit actor.
- - The following pseudocode shows the delivery mechanism:
+ - The following pseudo-code shows the delivery mechanism:
~~~
EMIT-TOUCH-SIGNAL( ACTOR )
# Performance Profiling {#performanceprofiling}
-DALi has many mechanisms for analysing performance including kernel, system and network logging.
+DALi has many mechanisms for analyzing performance including kernel, system and network logging.
## Background
Setting DALI_PERFORMANCE_TIMESTAMP_OUTPUT environment variable will enable time stamps.
-Tools such as Tizen dynamic analyser and StageHand can be used to provide a GUI display of
+Tools such as Tizen dynamic analyzer and StageHand can be used to provide a GUI display of
the output.
|------|--------------------------|--------------|
| 0 | log markers to DALi log (dlog on Tizen) | DALI_PERFORMANCE_TIMESTAMP_OUTPUT=1 dali-demo |
| 1 | log markers to kernel trace ( logs to ftrace )| DALI_PERFORMANCE_TIMESTAMP_OUTPUT=2 dali-demo |
-| 2 | log markers to system trace ( ttrace on Tizen for Tizen analyser) | DALI_PERFORMANCE_TIMESTAMP_OUTPUT=4 dali-demo |
+| 2 | log markers to system trace ( ttrace on Tizen for Tizen analyzer) | DALI_PERFORMANCE_TIMESTAMP_OUTPUT=4 dali-demo |
| 3 | log markers to network client (tcp port 3001+) | DALI_PERFORMANCE_TIMESTAMP_OUTPUT=8 dali-demo |
~~~
Ftrace is a kernel tracer designed to help developers find out what is going on inside the kernel.
-It can be used for analysing how long DALi takes to perform different tasks and
+It can be used for analyzing how long DALi takes to perform different tasks and
what DALi is doing in relation to other system processes / interrupts.
On Tizen if the kernel has been built with ftrace enabled, then DALi can log out to ftrace.
-This gives exact time stamps of the main events in Dali.
+This gives exact time stamps of the main events in DALi.
Current markers that are logged:
- Try to reduce actor count ( less actors == less processing)
- Delete any actors that are not visible, or move them off stage
- Use TextureAtlases ( reduces OpenGL driver calls to glBindTexture
- - Optimise / reduce any constraints used
+ - Optimize / reduce any constraints used
## High GPU occupancy
~~~{.cpp}
// C++
-// In this mode depth testing is turned off and order is determined by the hierachy (depth-first search order).
+// In this mode depth testing is turned off and order is determined by the hierarchy (depth-first search order).
// Not always recommended if there is going to be a lot of overdraw ( if lots of actors are on top of each other)
Actor::SetDrawMode( DrawMode::OVERLAY_2D ); // C++
~~~{.js}
// JavaScript
-// In this mode depth testing is turned off and order is determined by the hierachy (depth-first search order).
+// In this mode depth testing is turned off and order is determined by the hierarchy (depth-first search order).
// Not always recommended if there is going to be a lot of overdraw ( if lots of actors are on top of each other)
actor.drawMode = dali.DRAW_MODE_OVERLAY_2D;
- Use Dali::NinePatchImage where possible.
- Avoid using too many textures which contain alpha and require blending
- Avoid using too many Dali::Layer with depth testing enabled. Otherwise the layer has to clear the depth buffer.
- - Optimise any shaders used. Pixel shaders should be kept as lean as possible.
+ - Optimize any shaders used. Pixel shaders should be kept as lean as possible.
@class _Guide_Performance_Tips
The Popup can be configured to a preset type by using named types within the type-registry.
-These types are modifications / specialisations of a Popup. They provide the library user with a shortcut way of creating a specific type of Popup.
+These types are modifications / specializations of a Popup. They provide the library user with a shortcut way of creating a specific type of Popup.
The Popup control features a "Toast" popup type. This is a Popup that appears at the bottom of the screen, typically with some text. They are normally for informational purposes only.
ConfirmationPopup will automatically provide signals for 1 or 2 controls.
Note: The controls do not need to be PushButtons.
-These signals are dynamically created. The controls (typically PushButtons) must be specifially named so the ConfirmationPopup can locate them.
+These signals are dynamically created. The controls (typically PushButtons) must be specifically named so the ConfirmationPopup can locate them.
## Step 1 {#popupconfirmationstep1}
Name your controls.
The ConfirmationPopup will dynamically make the connection between the signalling control, and your signal handler.
-This allows connection of signals within both C++, JSON and Javascript APIs.
-If more manual control or customisable layout is needed, then it is recommended to use the Popup widget directly for full control.
+This allows connection of signals within both C++, JSON and JavaScript APIs.
+If more manual control or customizable layout is needed, then it is recommended to use the Popup widget directly for full control.
The JSON code example at the bottom of this document uses the ConfirmationPopup to allow signal connection from within the JSON description.
### Developer options:
* A target size of the image - this could be the full screen size for example.
-* A Fitting mMde - This determines how the image is fitted to the target dimensions. If necessary the image will be cropped, or have borders added automatically.
+* A Fitting mode - This determines how the image is fitted to the target dimensions. If necessary the image will be cropped, or have borders added automatically.
* A Sampling Mode - This determines the quality of the scaling (by specifying the type of filtering to use).
### Benefits of Resource Image Scaling:
There are more code examples later in this document under [API usage](#resourceimagescaling-apidetails). For now we will just give one full code example to show how this feature is used..
-Let's say we are writing a home-screen application for a smartphone.
+Let's say we are writing a home-screen application for a smart phone.
Here we have a large, square image that we want to set as the wallpaper on a tall and narrow phone screen.
We want to fill the screen without distorting the image or having black borders, and wasting as few pixels from the source image as possible.


-DALi provides the concept of a `FittingMode` to specify how a source image is mapped into a target rectangle, and the one we need here is `FittingMode::SCALE_TO_FILL` as it guarrentees to cover all of the pixels of the target dimensions specified.
+DALi provides the concept of a `FittingMode` to specify how a source image is mapped into a target rectangle, and the one we need here is `FittingMode::SCALE_TO_FILL` as it guarantees to cover all of the pixels of the target dimensions specified.
A second concept of a `SamplingMode` controls how source image pixels are combined during the scaling and allows the developer to trade speed for quality.
Since our image is to be loaded once and reused, we use `SamplingMode::BOX_THEN_LINEAR` which is the highest quality option.
- Target Size: Determine target size (from source image size and any user specified target dimensions).
- Target Image Dimensions: Determine the size the image should be scaled to (taking Fitting Mode into account)
- Scaling: Perform a scale to target image dimensions using the specified Sampling mode.
-- Crop or Add Borders: Automatically perfomed as necessary to maintain final target aspect (actual stored data size could be smaller).
+- Crop or Add Borders: Automatically performed as necessary to maintain final target aspect (actual stored data size could be smaller).
| `FittingMode` | **Operation** |
| ------------- | ------------- |
-| `SCALE_TO_FILL` | Centers the image on the target box and uniformly scales it so that it matches the target in one dimension and extends outside the target in the other. Chooses the dimension to match that results in the fewest pixels outside the target. Trims away the parts of the image outside the target box so as to match it exactly. This guarentees all of the target area is filled. |
-| `SHRINK_TO_FIT` | Centers the image on the target box and uniformly scales it so that it matches the target in one dimension and fits inside it in the other. This guarentees that all of the source image area is visible. |
+| `SCALE_TO_FILL` | Centers the image on the target box and uniformly scales it so that it matches the target in one dimension and extends outside the target in the other. Chooses the dimension to match that results in the fewest pixels outside the target. Trims away the parts of the image outside the target box so as to match it exactly. This guarantees all of the target area is filled. |
+| `SHRINK_TO_FIT` | Centers the image on the target box and uniformly scales it so that it matches the target in one dimension and fits inside it in the other. This guarantees that all of the source image area is visible. |
| `FIT_WIDTH` | Centers the image on the target box and uniformly scales it so that it matches the target width without regard for the target height. |
| `FIT_HEIGHT` | Centers the image on the target box and uniformly scales it so that it matches the target in height without regard for the target width. |
<!--
/**-->
-# Resources {#resoources}
+# Resources {#resources}
## Resource Image {#resource-image}
The application can connect to the Dali::ResourceImage::LoadingFinishedSignal() to get notified when the image has loaded.
By default, resource images start loading immediately and the data is released only when the ResourceImage handle is destroyed.
-To optimise an application's memory footprint, the application can ask resources to be only loaded when actually required and
+To optimize an application's memory footprint, the application can ask resources to be only loaded when actually required and
their data to be released automatically when they are no longer being used (not being used by Actors).
~~~{.cpp}
Dali::ResourceImage image = Dali::ResourceImage::New( "/my-path/my-image.png", Dali::ResourceImage::ON_DEMAND, Dali::Image::UNUSED );
~~~
## Hello World - Javascript
- The DALi script application is needed to run the Javascript which provides a Javascript runtime and an interface to Dali.
+ The DALi script application is needed to run the Javascript which provides a Javascript runtime and an interface to DALi.
~~~
scripting.example hello-world.js
@class _Guide_Script_Hello_World
-*/
\ No newline at end of file
+*/
## Includes {#includes}
-The "includes" section is an array of filenames to be merged in order to
+The "includes" section is an array of file names to be merged in order to
create a final in memory JSON tree.
The merge process will walk key, value attributes from the root JSON
~~~
When applied to an actor tree the actors are referenced by name. Names
-are not unique in Dali.
+are not unique in DALi.
When a style is applied in code DALi will perform a depth first search
stopping with the first matching name.
When the animation is created from code (or from a signal) the property
name search begins on the actor, if it isn't found the search continues
-on the attached shader object.
+on the attached renderer, and then on the attached shader object.
The actor property names and shader uniform names must not clash for the
uniform to animate correctly. The convention in DALi is to prepend
The stage section supports the immediate creation of actors at the time
the JSON is loaded.
-The stage is a tree of actors that can be added to Dali's stage object.
+The stage is a tree of actors that can be added to DALi's stage object.
~~~
// C++
# Actor and Control Properties {#actorprop}
-Each control has a set of supported properties documented in the "Dali
+Each control has a set of supported properties documented in the "DALi
UI Control Specification".
Please refer to the above document for further information about specific
- JavaScript to support:
- Rapid Application Development
- Hybrid C++/JavaScript applications
- - Leaverage third party JavaScript modules (backbone.js etc)
+ - Leverage third party JavaScript modules (backbone.js etc)
JSON support is built in to DALi.
@class _Guide_JSON_and_JavaScript_overview
-*/
\ No newline at end of file
+*/


-To cycle through the actor hierachy, keep clicking the same spot. Alternatively, select using the actor tree.
+To cycle through the actor hierarchy, keep clicking the same spot. Alternatively, select using the actor tree.

launch_app [APP_ID] __AUL_SDK__ DEBUG __DLP_DEBUG_ARG__ :10003
~~~
-@class _Guide_Visual_Debugger
\ No newline at end of file
+@class _Guide_Visual_Debugger
### Usage
-At version 1.1.35 auto scrolling is only supported in single line, mutliline text will not scroll and Text should be BEGIN aligned.
+At version 1.1.35 auto scrolling is only supported in single line, multiline text will not scroll and Text should be BEGIN aligned.
The ENABLE_AUTO_SCROLL property should be set to TRUE to enable scrolling.
Once enabled it will start scrolling until the loop count is completed or the ENABLE_AUTO_SCROLL set to false, setting ENABLE_AUTO_SCROLL to false will let the
text complete it's current scrolling loop then stop.
-## The additional properties below can be set to customise the scrolling behaviour
+## The additional properties below can be set to customize the scrolling behaviour
#### AUTO_SCROLL_SPEED
### Scroll Direction
-The scroll direction is choosen automatically with the following rules:
+The scroll direction is chosen automatically with the following rules:
If the text is single-lined it will scroll left when the text is Left to Right (LTR) or scroll right if text is Right to Left (RTL).
Before any text has been entered, the TextField can display some placeholder text.
An alternative placeholder can be displayed when the TextField has keyboard focus.
-For example a TextField used to enter a username could initially show "Unknown Name", and then show "Enter Name." when the cursor is shown.
+For example a TextField used to enter a user name could initially show "Unknown Name", and then show "Enter Name." when the cursor is shown.
Note *CR+LF* new line characters are replaced by a *LF* one.
This means that custom controls do not have to create actors, they can just reuse the existing visuals which increases performance.
Visuals reuse geometry, shaders etc. across controls and manages the renderer and material to exist only when the control is on-stage.
-Additionaly, they respond to actor size and color change, while also providing clipping at the renderer level.
+Additionally, they respond to actor size and color change, while also providing clipping at the renderer level.
DALi provides the following visuals:
+ [Color](@ref color-visual)
+ [Border](@ref border-visual)
+ [Mesh](@ref mesh-visual)
+ [Primitive](@ref primitive-visual)
+ + [Wireframe](@ref wireframe-visual)
Controls can provide properties that allow users to specify the visual type ( visualType ).
Setting visual properties are done via a property map.
| Property | String | Type | Description | Default Value | Range |
|---------------------------------------------------------------|-------------------|:------------------:|-----------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------:|:------------------------------:|
| Dali::Toolkit::PrimitiveVisual::Property::SHAPE | shape | INTEGER or STRING | The specific shape to render. [More info](@ref shape-details) | Dali::Toolkit::PrimitiveVisual::Shape::SPHERE, "SPHERE" | [See list](@ref shape-details) |
-| Dali::Toolkit::PrimitiveVisual::Property::COLOR | shapeColor | VECTOR4 | The color of the shape. | (0.5, 0.5, 0.5, 1.0) | 0.0 - 1.0 for each |
+| Dali::Toolkit::PrimitiveVisual::Property::MIX_COLOR | mixColor | VECTOR4 | The color of the shape. | (0.5, 0.5, 0.5, 1.0) | 0.0 - 1.0 for each |
| Dali::Toolkit::PrimitiveVisual::Property::SLICES | slices | INTEGER | The number of slices as you go around the shape. [More info](@ref slices-details) | 128 | 1 - 255 |
| Dali::Toolkit::PrimitiveVisual::Property::STACKS | stacks | INTEGER | The number of stacks as you go down the shape. [More info](@ref stacks-details) | 128 | 1 - 255 |
| Dali::Toolkit::PrimitiveVisual::Property::SCALE_TOP_RADIUS | scaleTopRadius | FLOAT | The scale of the radius of the top circle of a conical frustrum. | 1.0 | ≥ 0.0 |
map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::PRIMITIVE;
map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::SPHERE;
-map[ PrimitiveVisual::Property::COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
+map[ PrimitiveVisual::Property::MIX_COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
control.SetProperty( Control::Property::BACKGROUND, map );
~~~
map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::PRIMITIVE;
map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::CONICAL_FRUSTRUM;
-map[ PrimitiveVisual::Property::COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
+map[ PrimitiveVisual::Property::MIX_COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
map[ PrimitiveVisual::Property::SCALE_TOP_RADIUS ] = 1.0f;
map[ PrimitiveVisual::Property::SCALE_BOTTOM_RADIUS ] = 1.5f;
map[ PrimitiveVisual::Property::SCALE_HEIGHT ] = 3.0f;
map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::PRIMITIVE;
map[ PrimitiveVisual::Property::SHAPE ] = PrimitiveVisual::Shape::BEVELLED_CUBE;
-map[ PrimitiveVisual::Property::COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
+map[ PrimitiveVisual::Property::MIX_COLOR ] = Vector4( 1.0, 0.5, 0.0, 1.0 );
map[ PrimitiveVisual::Property::BEVEL_PERCENTAGE ] = 0.4f;
control.SetProperty( Control::Property::BACKGROUND, map );
~~~
+___________________________________________________________________________________________________
+
+## Wireframe Visual {#wireframe-visual}
+
+Renders a wireframe around a control's quad.
+Is mainly used for debugging and is the visual that replaces all other visuals when [Visual Debug Rendering](@ref debugrendering) is turned on.
+
+
+
+
+### Properties
+
+**VisualType:** Dali::Toolkit::Visual::WIREFRAME, "WIREFRAME"
+
+### Usage
+
+~~~{.cpp}
+// C++
+Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
+
+Dali::Property::Map map;
+map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::WIREFRAME;
+
+control.SetProperty( Control::Property::BACKGROUND, map );
+~~~
+
+~~~{.js}
+// JavaScript
+var control = new dali.Control( "Control" );
+
+control.background =
+{
+ visualType : "WIREFRAME"
+};
+~~~
+
@class _Guide_Control_Visuals
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 0.0.1
+Version: 1.2.5
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.1.45
+Version: 1.2.5
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
# profile setup
#############################
+%if "%{tizen_version_major}" == "2" && 0%{?tizen_profile_name:1}
+%define profile %{tizen_profile_name}
+%endif
+
+%if "%{profile}" == "mobile"
%define dali_toolkit_profile MOBILE
%define dali_style_folder 720x1280
# dali_style to be provided by build system as with dali_toolkit_profile or by passing --define 'dali_style 470x800' to the rpm build command
+%endif
-%if "%{?dali_style}"
- %define dali_style_folder %{dali_style}
+%if "%{profile}" == "tv"
+%define dali_toolkit_profile TV
+%define dali_style_folder 1920x1080
%endif
-# Further resource locations profiles can be provided here otherwise MOBILE will be used
-%if "%{tizen_profile_name}" == "mobile"
- %define dali_toolkit_profile MOBILE
+%if "%{?dali_style}"
+ %define dali_style_folder %{dali_style}
%endif
%description
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/actors/actor-enumerations.h>
#include <dali/public-api/actors/draw-mode.h>
-#include <dali/public-api/actors/image-actor.h>
-#include <dali/public-api/actors/blending.h>
#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/actors/sampling.h>
#include <dali/public-api/render-tasks/render-task.h>
{ "DRAW_MODE_NORMAL", DrawMode::NORMAL },
{ "DRAW_MODE_OVERLAY_2D", DrawMode::OVERLAY_2D },
- { "DRAW_MODE_STENCIL", DrawMode::STENCIL },
{ "RESOURCE_LOADING", Dali::ResourceLoading },
{ "RESOURCE_LOADING_SUCCEEDED", Dali::ResourceLoadingSucceeded },
{ "ALPHA_FUNCTION_SIN", AlphaFunction::SIN },
{ "ALPHA_FUNCTION_EASE_OUT_BACK", AlphaFunction::EASE_OUT_BACK },
+ { "CLIPPING_MODE_DISABLED", ClippingMode::DISABLED },
+ { "CLIPPING_MODE_CLIP_CHILDREN", ClippingMode::CLIP_CHILDREN },
};
const unsigned int EnumTableCount = sizeof(EnumTable)/sizeof(EnumTable[0]);
-
-
-
-
-
} // un-named name space
/*
- * 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.
* @param {Integer} options.height image height
* @param {Object } [options.nativeImage] ** currently not supported **
* @param {Integer} [options.pixelFormat] pixel format ( see dali constants, e.g. dali.PIXEL_FORMAT_RGB8888)
- * @param {Integer} [options.releasePolicy] optionally release memory when image is not visible on screen.
* @return {Object} Image
*/
Image New( const v8::FunctionCallbackInfo< v8::Value >& args )
return FrameBufferImage();
}
- Image::ReleasePolicy releasePolicy = Dali::Image::NEVER;
- v8::Local<v8::Value> releasePolicyValue = obj->Get( v8::String::NewFromUtf8( isolate, "releasePolicy" ) );
- if( releasePolicyValue->IsUint32() )
- {
- releasePolicy = static_cast<Image::ReleasePolicy>( releasePolicyValue->ToUint32()->Value() );
- }
-
- return FrameBufferImage::New( width, height, pixelFormat, releasePolicy );
+ return FrameBufferImage::New( width, height, pixelFormat );
}
} // FrameBufferImageApi
--- /dev/null
+*.dll
+examples/*.exe
+autom4te.cache/
+aclocal.m4
+config/
+config.*
+cpp/dali_wrap.cpp
+cpp/dali_wrap.h
+configure
--- /dev/null
+# 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.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+CLEANFILES = cpp/dali_wrap.* csharp/*.cs *.so *.dll \
+ examples/*.so examples/*.dll examples/*.exe
+
+BUILT_SOURCES = cpp/dali_wrap.cpp cpp/dali_wrap.h
+
+if HAVE_MCS
+if BUILD_MCS
+
+all-local: libNDalic.so NDali.dll
+
+libNDalic.so: cpp/dali_wrap.o
+ g++ -shared cpp/dali_wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
+
+cpp/dali_wrap.o: $(BUILT_SOURCES)
+ g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) cpp/dali_wrap.cpp -o cpp/dali_wrap.o
+
+NDali.dll: $(BUILT_SOURCES)
+ $(MCS) -nologo -target:library -out:NDali.dll csharp/*.cs
+
+check-local: examples/dali-test.exe \
+ examples/hello-world.exe \
+ examples/scroll-view.exe \
+ examples/libNDalic.so examples/NDali.dll
+
+examples/%.exe: examples/%.cs
+ $(MCS) -nologo -target:exe -out:$@ -reference:NDali.dll $<
+
+examples/libNDalic.so: libNDalic.so
+ cd examples && ln -sf ../libNDalic.so
+
+examples/NDali.dll: NDali.dll
+ cd examples && ln -sf ../NDali.dll
+
+endif
+endif
+
+# use swig to generate the CS wrapper code
+# then call our property-wrapper to inject DALi property getters / setters
+$(BUILT_SOURCES): SWIG/*.i
+ rm -f csharp/*.cs
+ $(SWIG) -csharp -c++ -outdir csharp \
+ $(DALI_CFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) -namespace Dali -o cpp/dali_wrap.cpp SWIG/dali.i
+ ./property-wrapper.rb
+ ./constructor-generator.rb
+
+dist-hook: $(BUILT_SOURCES)
+ mkdir -p $(distdir)/cpp
+ cp ./cpp/dali_wrap.cpp $(distdir)/cpp
+ cp ./cpp/dali_wrap.h $(distdir)/cpp
+ cp ./cpp/DaliWrapper.h ./cpp/DaliWrapper.cpp $(distdir)/cpp
+ cp ./cpp/stdafx.h $(distdir)/cpp
+ mkdir -p $(distdir)/csharp
+ cp ./csharp/*.csproj $(distdir)/csharp
+ cp ./csharp/*.cs $(distdir)/csharp
+ mkdir -p $(distdir)/examples
+ cp ./examples/*.csproj $(distdir)/examples
+ cp ./examples/*.cs $(distdir)/examples
+
+EXTRA_DIST = \
+ swig.cmd
+
--- /dev/null
+To build C# binding for Ubuntu desktop using SWIG for the first time:
+
+./autogen.sh
+./configure
+make
+
+To build C# binding for Ubuntu desktop using SWIG after updating:
+
+make maintainer-clean
+./configure
+make
+
+To build C# examples with the C# binding together for Ubuntu desktop:
+
+make check
+
+To run examples on Ubuntu desktop:
+
+cd examples
+DALI_WINDOW_WIDTH=480 DALI_WINDOW_HEIGHT=800 ./hello-world.exe
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%ignore *::Application(Internal::Adaptor::Application*);
+%ignore *::DragAndDropDetector(Internal::Adaptor::DragAndDropDetector*);
+%ignore *::Timer(Internal::Adaptor::Timer*);
+%ignore *::Window(Internal::Adaptor::Window*);
+
+%rename(StyleChangeType) Dali::StyleChange::Type;
+
+%include <dali/public-api/adaptor-framework/style-change.h>
+%include <dali/public-api/adaptor-framework/timer.h>
+%include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
+%include <dali/public-api/adaptor-framework/window.h>
+
+#if defined(SWIGCSHARP)
+
+// %include <arrays_csharp.i>
+// CSHARP_ARRAYS(char **, string)
+// %typemap(imtype, inattributes="[global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray, SizeParamIndex=0, ArraySubType=global::System.Runtime.InteropServices.UnmanagedType.LPStr)]") char **INPUT[] "string[]"
+// %apply int *INPUT { int *argc };
+// %apply char **INPUT[] { char **argv[] };
+
+%{
+ // keep argcs and argv so they're always available to DALi
+ int argC = 1;
+ char **argV = NULL;
+%}
+
+// Temporary hack to generate argv. Todo... support conversions from the C# strings[] in the argv that is generated below
+
+%typemap(in) ( int* argc, char **argv[] ) {
+
+ // Todo generate argv data from the C# args
+ char **array; // two dimensional array
+ int numStrings = 1; // number of strings
+ int stringLength = 30; // max string length.
+ array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
+ argV = array;
+
+ // allocate the string data
+ for( int i=0; i < numStrings; i++)
+ {
+ array[i]=(char *)malloc( stringLength * sizeof(char *) );
+ }
+ array[ numStrings ] = NULL; // we allocated +1 for hold the NULL part
+
+ strcpy( array[0], "dali-csharp-app");
+
+ $1 = &argC;
+ $2 = &argV;
+}
+
+// add interop services to the file
+//%typemap(csimports) Dali::Application "using System.Runtime.InteropServices;"
+
+%csmethodmodifiers Dali::Application::New() "
+ /**
+ * Outer::outer_method(int)
+ */
+ public";
+
+%typemap(in) ( int* argc, char **argv[] ) {
+
+ // Todo generate argv data from the C# args
+ char **array; // two dimensional array
+ int numStrings = 1; // number of strings
+ int stringLength = 30; // max string length.
+ array = (char **)malloc( (numStrings + 1 )* sizeof(char *) );
+ argV = array;
+
+ // allocate the string data
+ for( int i=0; i < numStrings; i++)
+ {
+ array[i]=(char *)malloc( stringLength * sizeof(char *) );
+ }
+ array[ numStrings ] = NULL; // we allocated +1 for hold the NULL part
+
+ strcpy( array[0], "dali-csharp-app");
+
+ $1 = &argC;
+ $2 = &argV;
+}
+
+%apply int* INPUT { int* argc };
+
+#endif
+
+%include <dali/public-api/adaptor-framework/application.h>
+
+%template(ApplicationSignal) Dali::Signal<void(Dali::Application&)>;
+%template(ApplicationControlSignal) Dali::Signal<void(Dali::Application&, void*)>;
+%template(TimerSignalType) Dali::Signal<bool()>;
+
+
+// Application specialisation
+// Macro to convert from a void * callback to a DALi C# object
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%apply int& INOUT { int& integerValue };
+%apply float& INOUT { float& floatValue };
+%apply bool& INOUT { bool& boolValue };
+%apply float& OUTPUT { float& localX };
+%apply float& OUTPUT { float& localY };
+%apply float& OUTPUT { float& viewportX };
+%apply float& OUTPUT { float& viewportY };
+
+#if defined(SWIGCSHARP)
+
+%include arrays_csharp.i
+%apply unsigned char INPUT[] { unsigned char* pixelBuffer}
+%apply unsigned char INPUT[] { unsigned char* buffer}
+%apply unsigned char INPUT[] { unsigned char* at}
+%apply unsigned char INPUT[] { unsigned char* iterator}
+%apply unsigned char INPUT[] { unsigned char* first}
+//%apply unsigned char OUTPUT[] { unsigned char* GetBuffer}
+//%apply unsigned char OUTPUT[] { unsigned char* Begin}
+//%apply unsigned char OUTPUT[] { unsigned char* End}
+%apply unsigned char OUTPUT[] { unsigned char* ValueOfIndex}
+%apply unsigned short INPUT[] { unsigned short* indices}
+%apply float INPUT[] { float* array }
+
+#endif
+
+%ignore *::Animation(Internal::Animation*);
+%ignore *::Actor(Internal::Actor*);
+%ignore *::BufferImage(Internal::BufferImage*);
+%ignore *::CameraActor(Internal::CameraActor*);
+%ignore *::CustomActor(Internal::CustomActor*);
+%ignore *::EncodedBufferImage(Internal::EncodedBufferImage*);
+%ignore *::FrameBuffer(Internal::FrameBuffer*);
+%ignore *::FrameBufferImage(Internal::FrameBufferImage*);
+%ignore *::Geometry(Internal::Geometry*);
+%ignore *::Handle(Dali::Internal::Object*);
+%ignore *::Image(Internal::Image*);
+%ignore *::KeyFrames(Internal::KeyFrames*);
+%ignore *::Layer(Internal::Layer*);
+%ignore *::LinearConstrainer(Internal::LinearConstrainer*);
+%ignore *::LongPressGestureDetector(Internal::LongPressGestureDetector*);
+%ignore *::NativeImage(Internal::NativeImage*);
+%ignore *::NinePatchImage(Internal::NinePatchImage*);
+%ignore *::ObjectRegistry(Internal::ObjectRegistry*);
+%ignore *::PanGestureDetector(Internal::PanGestureDetector*);
+%ignore *::Path(Internal::Path*);
+%ignore *::PathConstrainer(Internal::PathConstrainer*);
+%ignore *::PinchGestureDetector(Internal::PinchGestureDetector*);
+%ignore *::PixelData(Internal::PixelData*);
+%ignore *::PropertyBuffer(Internal::PropertyBuffer*);
+%ignore *::PropertyNotification(Internal::PropertyNotification*);
+%ignore *::Renderer(Internal::Renderer*);
+%ignore *::RenderTask(Internal::RenderTask*);
+%ignore *::RenderTaskList(Internal::RenderTaskList*);
+%ignore *::ResourceImage(Internal::ResourceImage*);
+%ignore *::Sampler(Internal::Sampler*);
+%ignore *::Shader(Internal::Shader*);
+%ignore *::Stage(Internal::Stage*);
+%ignore *::TapGestureDetector(Internal::TapGestureDetector*);
+%ignore *::Texture(Internal::NewTexture*);
+%ignore *::TextureSet(Internal::TextureSet*);
+%ignore *::TouchData(Internal::TouchData*);
+%ignore *::TypeInfo(Internal::TypeInfo*);
+%ignore *::GetExtension();
+%ignore *::Initialize(Internal::CustomActor&);
+%ignore *::GetOwner() const;
+%ignore *::ParentOrigin::DEFAULT;
+%ignore *::AnchorPoint::DEFAULT;
+
+%rename(ParentOriginTop) Dali::ParentOrigin::TOP;
+%rename(ParentOriginBottom) Dali::ParentOrigin::BOTTOM;
+%rename(ParentOriginLeft) Dali::ParentOrigin::LEFT;
+%rename(ParentOriginRight) Dali::ParentOrigin::RIGHT;
+%rename(ParentOriginMiddle) Dali::ParentOrigin::MIDDLE;
+%rename(ParentOriginTopLeft) Dali::ParentOrigin::TOP_LEFT;
+%rename(ParentOriginTopCenter) Dali::ParentOrigin::TOP_CENTER;
+%rename(ParentOriginTopRight) Dali::ParentOrigin::TOP_RIGHT;
+%rename(ParentOriginCenterLeft) Dali::ParentOrigin::CENTER_LEFT;
+%rename(ParentOriginCenter) Dali::ParentOrigin::CENTER;
+%rename(ParentOriginCenterRight) Dali::ParentOrigin::CENTER_RIGHT;
+%rename(ParentOriginBottomLeft) Dali::ParentOrigin::BOTTOM_LEFT;
+%rename(ParentOriginBottomCenter) Dali::ParentOrigin::BOTTOM_CENTER;
+%rename(ParentOriginBottomRight) Dali::ParentOrigin::BOTTOM_RIGHT;
+%rename(AnchorPointTop) Dali::AnchorPoint::TOP;
+%rename(AnchorPointBottom) Dali::AnchorPoint::BOTTOM;
+%rename(AnchorPointLeft) Dali::AnchorPoint::LEFT;
+%rename(AnchorPointRight) Dali::AnchorPoint::RIGHT;
+%rename(AnchorPointMiddle) Dali::AnchorPoint::MIDDLE;
+%rename(AnchorPointTopLeft) Dali::AnchorPoint::TOP_LEFT;
+%rename(AnchorPointTopCenter) Dali::AnchorPoint::TOP_CENTER;
+%rename(AnchorPointTopRight) Dali::AnchorPoint::TOP_RIGHT;
+%rename(AnchorPointCenterLeft) Dali::AnchorPoint::CENTER_LEFT;
+%rename(AnchorPointCenter) Dali::AnchorPoint::CENTER;
+%rename(AnchorPointCenterRight) Dali::AnchorPoint::CENTER_RIGHT;
+%rename(AnchorPointBottomLeft) Dali::AnchorPoint::BOTTOM_LEFT;
+%rename(AnchorPointBottomCenter) Dali::AnchorPoint::BOTTOM_CENTER;
+%rename(AnchorPointBottomRight) Dali::AnchorPoint::BOTTOM_RIGHT;
+%rename(ConvertToFloat) operator float;
+%rename(DimensionType) Dali::Dimension::Type;
+%rename(ResizePolicyType) Dali::ResizePolicy::Type;
+%rename(ResizePolicyDefault) Dali::ResizePolicy::DEFAULT;
+%rename(SizeScalePolicyType) Dali::SizeScalePolicy::Type;
+%rename(HorizontalAlignmentType) Dali::HorizontalAlignment::Type;
+%rename(VerticalAlignmentType) Dali::VerticalAlignment::Type;
+%rename(ClippingModeType) Dali::ClippingMode::Type;
+%rename(FilterModeType) Dali::FilterMode::Type;
+%rename(WrapModeType) Dali::WrapMode::Type;
+%rename(PixelFormat) Dali::Pixel::Format;
+%rename(TextureType) Dali::TextureType::Type;
+%rename(FaceCullingModeType) Dali::FaceCullingMode::Type;
+%rename(BlendModeType) Dali::BlendMode::Type;
+%rename(BlendEquationType) Dali::BlendEquation::Type;
+%rename(BlendFactorType) Dali::BlendFactor::Type;
+%rename(DepthWriteModeType) Dali::DepthWriteMode::Type;
+%rename(DepthTestModeType) Dali::DepthTestMode::Type;
+%rename(DepthFunctionType) Dali::DepthFunction::Type;
+%rename(RenderModeType) Dali::RenderMode::Type;
+%rename(StencilFunctionType) Dali::StencilFunction::Type;
+%rename(StencilModeType) Dali::StencilMode::Type;
+%rename(StencilOperationType) Dali::StencilOperation::Type;
+%rename(DrawModeType) Dali::DrawMode::Type;
+%rename(PointStateType) Dali::PointState::Type;
+%rename(FittingModeType) Dali::FittingMode::Type;
+%rename(FittingModeDefault) Dali::FittingMode::DEFAULT;
+%rename(SamplingModeType) Dali::SamplingMode::Type;
+%rename(RenderBufferFormat) Dali::RenderBuffer::Format;
+%rename(BlendingModeType) Dali::BlendingMode::Type;
+%rename(BlendingFactorType) Dali::BlendingFactor::Type;
+%rename(BlendingEquationType) Dali::BlendingEquation::Type;
+%rename(CameraType) Dali::Camera::Type;
+%rename(LayerBehavior) Dali::Layer::Behavior;
+
+typedef std::pair<std::string, Dali::Property::Value> StringValuePair;
+typedef std::vector<Dali::TouchPoint> TouchPointContainer;
+typedef std::pair< Dali::Radian, Dali::Radian > AngleThresholdPair;
+
+%include <dali/public-api/object/ref-object.h>
+%include <dali/public-api/object/any.h>
+
+%include <dali/public-api/common/intrusive-ptr.h>
+
+%include <dali/public-api/math/vector2.h>
+%include <dali/public-api/math/vector3.h>
+%include <dali/public-api/math/vector4.h>
+%include <dali/public-api/math/rect.h>
+%include <dali/public-api/math/uint-16-pair.h>
+%include <dali/public-api/math/degree.h>
+%include <dali/public-api/math/radian.h>
+%include <dali/public-api/math/quaternion.h>
+%include <dali/public-api/math/matrix.h>
+%include <dali/public-api/math/matrix3.h>
+%include <dali/public-api/math/random.h>
+%include <dali/public-api/math/angle-axis.h>
+%include <dali/public-api/math/viewport.h>
+
+%include <dali/public-api/object/property-index-ranges.h>
+%include <dali/public-api/object/property.h>
+%include <dali/public-api/object/property-array.h>
+%include <dali/public-api/object/property-map.h>
+%include <dali/public-api/object/property-types.h>
+%include <dali/public-api/object/property-value.h>
+%include <dali/public-api/object/base-object.h>
+%include <dali/public-api/object/base-handle.h>
+
+%include <dali/public-api/signals/connection-tracker-interface.h>
+%include <dali/public-api/signals/signal-slot-observers.h>
+%include <dali/public-api/signals/connection-tracker.h>
+%include <dali/public-api/signals/dali-signal.h>
+
+%include <dali/public-api/object/object-registry.h>
+%include <dali/public-api/object/property-conditions.h>
+%include <dali/public-api/object/property-notification-declarations.h>
+%include <dali/public-api/object/property-notification.h>
+%include <dali/public-api/object/handle.h>
+%include <dali/public-api/object/type-info.h>
+
+%include <dali/public-api/common/constants.h>
+%include <dali/public-api/actors/actor-enumerations.h>
+%include <dali/public-api/common/dali-vector.h>
+%include <dali/public-api/common/vector-wrapper.h>
+
+%include <dali/public-api/images/image.h>
+%include <dali/public-api/actors/sampling.h>
+%include <dali/public-api/images/pixel.h>
+%include <dali/public-api/images/pixel-data.h>
+
+%include <dali/public-api/rendering/texture.h>
+%include <dali/public-api/rendering/sampler.h>
+%include <dali/public-api/rendering/texture-set.h>
+%include <dali/public-api/rendering/property-buffer.h>
+%include <dali/public-api/rendering/geometry.h>
+%include <dali/public-api/rendering/shader.h>
+%include <dali/public-api/rendering/renderer.h>
+%include <dali/public-api/actors/draw-mode.h>
+%include <dali/public-api/common/loading-state.h>
+%include <dali/public-api/rendering/frame-buffer.h>
+%include <dali/public-api/render-tasks/render-task-list.h>
+%include <dali/public-api/render-tasks/render-task.h>
+
+%include <dali/public-api/events/touch-point.h>
+%include <dali/public-api/events/point-state.h>
+%include <dali/public-api/events/touch-data.h>
+%include <dali/public-api/events/gesture-detector.h>
+%include <dali/public-api/events/gesture.h>
+%include <dali/public-api/events/hover-event.h>
+%include <dali/public-api/events/key-event.h>
+%include <dali/public-api/events/long-press-gesture-detector.h>
+%include <dali/public-api/events/long-press-gesture.h>
+%include <dali/public-api/events/wheel-event.h>
+
+%include <dali/public-api/actors/actor.h>
+%include <dali/public-api/actors/layer.h>
+%include <dali/public-api/common/stage.h>
+%include <dali/public-api/size-negotiation/relayout-container.h>
+%include <dali/public-api/actors/custom-actor-impl.h>
+%include <dali/public-api/actors/custom-actor.h>
+
+%include <dali/public-api/events/pan-gesture-detector.h>
+%include <dali/public-api/events/pan-gesture.h>
+%include <dali/public-api/events/pinch-gesture-detector.h>
+%include <dali/public-api/events/pinch-gesture.h>
+%include <dali/public-api/events/tap-gesture-detector.h>
+%include <dali/public-api/events/tap-gesture.h>
+%include <dali/public-api/events/touch-event.h>
+
+%include <dali/public-api/animation/alpha-function.h>
+%include <dali/public-api/animation/key-frames.h>
+%include <dali/public-api/animation/path.h>
+%include <dali/public-api/animation/time-period.h>
+%include <dali/public-api/animation/animation.h>
+%include <dali/public-api/animation/linear-constrainer.h>
+%include <dali/devel-api/animation/path-constrainer.h>
+
+%include <dali/public-api/common/view-mode.h>
+%include <dali/public-api/images/image-operations.h>
+%include <dali/public-api/images/buffer-image.h>
+%include <dali/public-api/images/encoded-buffer-image.h>
+%include <dali/public-api/images/native-image.h>
+%include <dali/public-api/images/native-image-interface.h>
+%include <dali/public-api/images/resource-image.h>
+%include <dali/public-api/images/nine-patch-image.h>
+%include <dali/public-api/images/frame-buffer-image.h>
+
+%include <dali/public-api/actors/blending.h>
+%include <dali/public-api/actors/camera-actor.h>
+
+%template(StringValuePair) std::pair<std::string, Dali::Property::Value>;
+%template(TouchPointContainer) std::vector<Dali::TouchPoint>;
+%template(RectDouble) Dali::Rect<double>;
+%template(RectInteger) Dali::Rect<int>;
+%template(RectUnsignedInteger) Dali::Rect<unsigned int>;
+%template(RectFloat) Dali::Rect<float>;
+%template(VectorInteger) Dali::Vector<int>;
+%template(VectorFloat) Dali::Vector<float>;
+%template(VectorUnsignedChar) Dali::Vector<unsigned char>;
+%template(VectorUint16Pair) Dali::Vector<Dali::Uint16Pair>;
+%template(VoidSignal) Dali::Signal<void()>;
+%template(BoolSignal) Dali::Signal<bool()>;
+%template(FloatSignal) Dali::Signal<void(float)>;
+%template(ObjectCreatedSignal) Dali::Signal<void(Dali::BaseHandle)>;
+%template(ObjectDestroyedSignal) Dali::Signal<void(const Dali::RefObject*)>;
+%template(PropertyNotifySignal) Dali::Signal<void(Dali::PropertyNotification&)>;
+%template(ImageSignal) Dali::Signal<void(Dali::Image)>;
+%template(RenderTaskSignal) Dali::Signal<void(Dali::RenderTask&)>;
+%template(LongPressGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::LongPressGesture&)>;
+%template(ActorTouchEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchEvent&)>;
+%template(ActorTouchDataSignal) Dali::Signal<bool (Dali::Actor, const Dali::TouchData&)>;
+%template(ActorHoverEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::HoverEvent&)>;
+%template(ActorWheelEventSignal) Dali::Signal<bool (Dali::Actor, const Dali::WheelEvent&)>;
+%template(ActorSignal) Dali::Signal<void (Dali::Actor)>;
+%template(KeyEventSignal) Dali::Signal<void (const Dali::KeyEvent&)>;
+%template(TouchEventSignal) Dali::Signal<void (const Dali::TouchEvent&)>;
+%template(TouchSignal) Dali::Signal<void (const Dali::TouchData&)>;
+%template(StageWheelEventSignal) Dali::Signal<void (const Dali::WheelEvent&)>;
+%template(AngleThresholdPair) std::pair<Dali::Radian, Dali::Radian>;
+%template(PanGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::PanGesture&)>;
+%template(PinchGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::PinchGesture&)>;
+%template(TapGestureDetectedSignal) Dali::Signal<void (Dali::Actor, const Dali::TapGesture&)>;
+%template(AnimationSignal) Dali::Signal<void(Dali::Animation&)>;
+%template(ResourceImageSignal) Dali::Signal<void(Dali::ResourceImage)>;
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// common name mappings
+#if defined(SWIGCSHARP)
+%rename(Assign) operator=;
+%rename(Add) operator+;
+%rename(AddAssign) operator+=;
+%rename(Subtract) operator-;
+%rename(SubtractAssign) operator-=;
+%rename(Multiply) operator*;
+%rename(MultiplyAssign) operator*=;
+%rename(Divide) operator/;
+%rename(DivideAssign) operator/=;
+%rename(Assign) operator=;
+%rename(EqualTo) operator==;
+%rename(NotEqualTo) operator!=;
+%rename(LessThan) operator<;
+%rename(GreaterThan) operator>;
+%rename(ValueOfIndex) operator[];
+#endif
+
+%typemap(cscode) Dali::Vector2 %{
+ public static Vector2 operator+(Vector2 arg1, Vector2 arg2) {
+ return arg1.Add(arg2);
+ }
+
+ public static Vector2 operator-(Vector2 arg1, Vector2 arg2) {
+ return arg1.Subtract(arg2);
+ }
+
+ public static Vector2 operator-(Vector2 arg1) {
+ return arg1.Subtract();
+ }
+
+ public static Vector2 operator*(Vector2 arg1, Vector2 arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Vector2 operator*(Vector2 arg1, float arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Vector2 operator/(Vector2 arg1, Vector2 arg2) {
+ return arg1.Divide(arg2);
+ }
+
+ public static Vector2 operator/(Vector2 arg1, float arg2) {
+ return arg1.Divide(arg2);
+ }
+
+ public float this[uint index]
+ {
+ get
+ {
+ return ValueOfIndex(index);
+ }
+ }
+
+ public static Vector2 GetVector2FromPtr(global::System.IntPtr cPtr) {
+ Vector2 ret = new Vector2(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%typemap(cscode) Dali::Vector3 %{
+ public static Vector3 operator+(Vector3 arg1, Vector3 arg2) {
+ return arg1.Add(arg2);
+ }
+
+ public static Vector3 operator-(Vector3 arg1, Vector3 arg2) {
+ return arg1.Subtract(arg2);
+ }
+
+ public static Vector3 operator-(Vector3 arg1) {
+ return arg1.Subtract();
+ }
+
+ public static Vector3 operator*(Vector3 arg1, Vector3 arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Vector3 operator*(Vector3 arg1, float arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Vector3 operator/(Vector3 arg1, Vector3 arg2) {
+ return arg1.Divide(arg2);
+ }
+
+ public static Vector3 operator/(Vector3 arg1, float arg2) {
+ return arg1.Divide(arg2);
+ }
+
+ public float this[uint index]
+ {
+ get
+ {
+ return ValueOfIndex(index);
+ }
+ }
+
+ public static Vector3 GetVector3FromPtr(global::System.IntPtr cPtr) {
+ Vector3 ret = new Vector3(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%typemap(cscode) Dali::Vector4 %{
+ public static Vector4 operator+(Vector4 arg1, Vector4 arg2) {
+ return arg1.Add(arg2);
+ }
+
+ public static Vector4 operator-(Vector4 arg1, Vector4 arg2) {
+ return arg1.Subtract(arg2);
+ }
+
+ public static Vector4 operator-(Vector4 arg1) {
+ return arg1.Subtract();
+ }
+
+ public static Vector4 operator*(Vector4 arg1, Vector4 arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Vector4 operator*(Vector4 arg1, float arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Vector4 operator/(Vector4 arg1, Vector4 arg2) {
+ return arg1.Divide(arg2);
+ }
+
+ public static Vector4 operator/(Vector4 arg1, float arg2) {
+ return arg1.Divide(arg2);
+ }
+
+ public float this[uint index]
+ {
+ get
+ {
+ return ValueOfIndex(index);
+ }
+ }
+
+ public static Vector4 GetVector4FromPtr(global::System.IntPtr cPtr) {
+ Vector4 ret = new Vector4(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%typemap(cscode) Dali::Matrix %{
+ public static Vector4 operator*(Matrix arg1, Vector4 arg2) {
+ return arg1.Multiply(arg2);
+ }
+%}
+
+%typemap(cscode) Dali::Quaternion %{
+ public static Quaternion operator+(Quaternion arg1, Quaternion arg2) {
+ return arg1.Add(arg2);
+ }
+
+ public static Quaternion operator-(Quaternion arg1, Quaternion arg2) {
+ return arg1.Subtract(arg2);
+ }
+
+ public static Quaternion operator-(Quaternion arg1) {
+ return arg1.Subtract();
+ }
+
+ public static Quaternion operator*(Quaternion arg1, Quaternion arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Vector3 operator*(Quaternion arg1, Vector3 arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Quaternion operator*(Quaternion arg1, float arg2) {
+ return arg1.Multiply(arg2);
+ }
+
+ public static Quaternion operator/(Quaternion arg1, Quaternion arg2) {
+ return arg1.Divide(arg2);
+ }
+
+ public static Quaternion operator/(Quaternion arg1, float arg2) {
+ return arg1.Divide(arg2);
+ }
+%}
+
+%typemap(cscode) Dali::Property::Array %{
+ public Property.Value this[uint index]
+ {
+ get
+ {
+ return ValueOfIndex(index);
+ }
+ }
+%}
+
+%typemap(cscode) Dali::Property::Map %{
+ public Property.Value this[string key]
+ {
+ get
+ {
+ return ValueOfIndex(key);
+ }
+ }
+
+ public Property.Value this[int key]
+ {
+ get
+ {
+ return ValueOfIndex(key);
+ }
+ }
+%}
+
+%typemap(cscode) Dali::Uint16Pair %{
+ public static bool operator<(Uint16Pair arg1, Uint16Pair arg2) {
+ return arg1.LessThan(arg2);
+ }
+
+ public static bool operator>(Uint16Pair arg1, Uint16Pair arg2) {
+ return arg1.GreaterThan(arg2);
+ }
+
+%}
+
+/**
+ * Extend the C++ base handle to include a IsHandleEmpty() function
+ * This is because from C# we can't wrap the operator BooleanType() function
+ */
+%extend Dali::BaseHandle {
+ bool IsHandleEmpty() const {
+ if( *$self )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+};
+
+/**
+ * Extend C# base handle to support true / false testing of base handle
+ * so we can do
+ * if ( actor )
+ * {
+ * ...
+ * }
+ */
+%typemap(cscode) Dali::BaseHandle %{
+
+ public static bool operator true(BaseHandle handle)
+ {
+ if( handle!= null )
+ {
+ return handle.IsHandleEmpty();
+ }
+ else
+ {
+ return false;
+ }
+ }
+ public static bool operator false(BaseHandle handle)
+ {
+ return handle.IsHandleEmpty();
+ }
+%}
+
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+%apply unsigned int& OUTPUT { unsigned int& volume };
+
+%ignore *::AccessibilityManager(Internal::AccessibilityManager*);
+%ignore *::Alignment(Internal::Alignment&);
+%ignore *::Alignment(Dali::Internal::CustomActor*);
+%ignore *::Button(Internal::Button&);
+%ignore *::Button(Dali::Internal::CustomActor*);
+%ignore *::CheckBoxButton(Internal::CheckBoxButton&);
+%ignore *::CheckBoxButton(Dali::Internal::CustomActor*);
+%ignore *::Control(Dali::Internal::CustomActor*);
+%ignore *::FlexContainer(Internal::FlexContainer&);
+%ignore *::FlexContainer(Dali::Internal::CustomActor*);
+%ignore *::GaussianBlurView(Internal::GaussianBlurView&);
+%ignore *::GaussianBlurView(Dali::Internal::CustomActor*);
+%ignore *::ImageView(Internal::ImageView&);
+%ignore *::ImageView(Dali::Internal::CustomActor*);
+%ignore *::ItemView(Internal::ItemView&);
+%ignore *::ItemView(Dali::Internal::CustomActor*);
+%ignore *::KeyboardFocusManager(Internal::KeyboardFocusManager*);
+%ignore *::Model3dView(Internal::Model3dView&);
+%ignore *::Model3dView(Dali::Internal::CustomActor*);
+%ignore *::PageTurnLandscapeView(Internal::PageTurnLandscapeView&);
+%ignore *::PageTurnLandscapeView(Dali::Internal::CustomActor*);
+%ignore *::PageTurnPortraitView(Internal::PageTurnPortraitView&);
+%ignore *::PageTurnPortraitView(Dali::Internal::CustomActor*);
+%ignore *::PageTurnView(Internal::PageTurnView&);
+%ignore *::PageTurnView(Dali::Internal::CustomActor*);
+%ignore *::Popup(Internal::Popup&);
+%ignore *::Popup(Dali::Internal::CustomActor*);
+%ignore *::PushButton(Internal::PushButton&);
+%ignore *::PushButton(Dali::Internal::CustomActor*);
+%ignore *::RadioButton(Internal::RadioButton&);
+%ignore *::RadioButton(Dali::Internal::CustomActor*);
+%ignore *::Scrollable(Internal::Scrollable&);
+%ignore *::Scrollable(Dali::Internal::CustomActor*);
+%ignore *::ScrollBar(Internal::ScrollBar&);
+%ignore *::ScrollBar(Dali::Internal::CustomActor*);
+%ignore *::ScrollView(Internal::ScrollView&);
+%ignore *::ScrollView(Dali::Internal::CustomActor*);
+%ignore *::ScrollViewEffect(Internal::ScrollViewEffect*);
+%ignore *::Slider(Internal::Slider&);
+%ignore *::Slider(Dali::Internal::CustomActor*);
+%ignore *::StyleManager(Internal::StyleManager*);
+%ignore *::TableView(Internal::TableView&);
+%ignore *::TableView(Dali::Internal::CustomActor*);
+%ignore *::TextEditor(Internal::TextEditor&);
+%ignore *::TextEditor(Dali::Internal::CustomActor*);
+%ignore *::TextField(Internal::TextField&);
+%ignore *::TextField(Dali::Internal::CustomActor*);
+%ignore *::TextLabel(Internal::TextLabel&);
+%ignore *::TextLabel(Dali::Internal::CustomActor*);
+%ignore *::VideoView(Internal::VideoView&);
+%ignore *::VideoView(Dali::Internal::CustomActor*);
+%ignore *::VisualFactory(Dali::Internal::VisualFactory*);
+%ignore *::Base(Dali::Internal::Visual::Base*);
+%ignore *::GetExtension();
+%ignore *::GetControlExtension();
+
+%rename(ControlImpl) Dali::Toolkit::Internal::Control;
+%rename(VisualBase) Dali::Toolkit::Visual::Base;
+%rename(ControlOrientationType) Dali::Toolkit::ControlOrientation::Type;
+%rename(DefaultItemLayoutType) Dali::Toolkit::DefaultItemLayout::Type;
+%rename(NewItemLayout) Dali::Toolkit::DefaultItemLayout::New;
+%rename(ContentDirectionType) Dali::Toolkit::FlexContainer::ContentDirection;
+%rename(FlexDirectionType) Dali::Toolkit::FlexContainer::FlexDirection;
+%rename(IluminationTypeEnum) Dali::Toolkit::Model3dView::IlluminationType;
+%rename(DisplayStateType) Dali::Toolkit::Popup::DisplayState;
+%rename(ContextualModeType) Dali::Toolkit::Popup::ContextualMode;
+%rename(AnimationModeType) Dali::Toolkit::Popup::AnimationMode;
+%rename(IndicatorHeightPolicyType) Dali::Toolkit::ScrollBar::IndicatorHeightPolicy;
+%rename(ExceedPolicyType) Dali::Toolkit::TextField::ExceedPolicy;
+%rename(ToolkitPropertyRange) Dali::Toolkit::PropertyRanges;
+%rename(VisualType) Dali::Toolkit::Visual::Type;
+%rename(VisualShaderType) Dali::Toolkit::Visual::Shader::Property;
+%rename(GradientVisualUnitsType) Dali::Toolkit::GradientVisual::Units::Type;
+%rename(GradientVisualSpreadMethodType) Dali::Toolkit::GradientVisual::SpreadMethod::Type;
+%rename(MeshVisualShadingModeValue) Dali::Toolkit::MeshVisual::ShadingMode::Value;
+%rename(PrimitiveVisualShapeType) Dali::Toolkit::PrimitiveVisual::Shape::Type;
+%rename(PRIMITIVE_VISUAL_COLOR) Dali::Toolkit::PrimitiveVisual::Property::COLOR;
+%rename(PRIMITIVE_VISUAL_MIX_COLOR) Dali::Toolkit::PrimitiveVisual::Property::MIX_COLOR;
+%rename(PRIMITIVE_VISUAL_LIGHT_POSITION) Dali::Toolkit::PrimitiveVisual::Property::LIGHT_POSITION;
+%rename(VISUAL_PROPERTY_TYPE) Dali::Toolkit::Visual::Property::TYPE;
+%rename(VISUAL_PROPERTY_SHADER) Dali::Toolkit::Visual::Property::SHADER;
+%rename(IMAGE_VISUAL_URL) Dali::Toolkit::ImageVisual::Property::URL;
+%rename(IMAGE_VISUAL_FITTING_MODE) Dali::Toolkit::ImageVisual::Property::FITTING_MODE;
+%rename(IMAGE_VISUAL_SAMPLING_MODE) Dali::Toolkit::ImageVisual::Property::SAMPLING_MODE;
+%rename(IMAGE_VISUAL_DESIRED_WIDTH) Dali::Toolkit::ImageVisual::Property::DESIRED_WIDTH;
+%rename(IMAGE_VISUAL_DESIRED_HEIGHT) Dali::Toolkit::ImageVisual::Property::DESIRED_HEIGHT;
+%rename(IMAGE_VISUAL_SYNCHRONOUS_LOADING) Dali::Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING;
+%rename(IMAGE_VISUAL_BORDER_ONLY) Dali::Toolkit::ImageVisual::Property::BORDER_ONLY;
+%rename(COLOR_VISUAL_MIX_COLOR) Dali::Toolkit::Color::Visual::Property::MIX_COLOR;
+
+%csconstvalue("PropertyRanges.PROPERTY_REGISTRATION_START_INDEX") PROPERTY_START_INDEX;
+%csconstvalue("Control.PropertyRange.PROPERTY_START_INDEX+1000") PROPERTY_END_INDEX;
+%csconstvalue("PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX") CHILD_PROPERTY_START_INDEX;
+%csconstvalue("PropertyRanges.CHILD_PROPERTY_REGISTRATION_START_INDEX+1000") CHILD_PROPERTY_END_INDEX;
+%csconstvalue("PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX") ANIMATABLE_PROPERTY_START_INDEX;
+%csconstvalue("PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX+1000") ANIMATABLE_PROPERTY_END_INDEX;
+%csconstvalue("PropertyRanges.CORE_PROPERTY_MAX_INDEX+1") VISUAL_PROPERTY_BASE_START_INDEX;
+%csconstvalue("1 << 5") REQUIRES_STYLE_CHANGE_SIGNALS;
+%csconstvalue("1 << 6") REQUIRES_KEYBOARD_NAVIGATION_SUPPORT;
+
+typedef unsigned int ItemId;
+typedef std::vector<ItemId> ItemIdContainer;
+typedef std::pair<ItemId, Actor> Item;
+typedef std::vector<Item> ItemContainer;
+typedef Dali::IntrusivePtr<Dali::Toolkit::Ruler> RulerPtr;
+
+%include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
+
+%include <dali-toolkit/public-api/visuals/visual-properties.h>
+%include <dali-toolkit/public-api/visuals/border-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/color-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
+%include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
+
+%include <dali-toolkit/devel-api/builder/builder.h>
+
+%include <dali-toolkit/public-api/controls/control-impl.h>
+%include <dali-toolkit/public-api/controls/control.h>
+
+%include <dali-toolkit/public-api/controls/alignment/alignment.h>
+%include <dali-toolkit/public-api/controls/buttons/button.h>
+%include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
+%include <dali-toolkit/public-api/controls/buttons/push-button.h>
+%include <dali-toolkit/public-api/controls/buttons/radio-button.h>
+%include <dali-toolkit/public-api/controls/flex-container/flex-container.h>
+%include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
+%include <dali-toolkit/public-api/controls/image-view/image-view.h>
+%include <dali-toolkit/public-api/controls/model3d-view/model3d-view.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-turn-landscape-view.h>
+%include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
+%include <dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h>
+%include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
+%include <dali-toolkit/public-api/enums.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
+%include <dali-toolkit/public-api/controls/scrollable/item-view/item-view.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-constraints.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-page-path-effect.h>
+%include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+%include <dali-toolkit/public-api/controls/table-view/table-view.h>
+%include <dali-toolkit/public-api/text/rendering-backend.h>
+%include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
+%include <dali-toolkit/public-api/controls/text-controls/text-field.h>
+%include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+%include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
+%include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
+%include <dali-toolkit/public-api/styling/style-manager.h>
+%include <dali-toolkit/public-api/controls/slider/slider.h>
+%include <dali-toolkit/public-api/controls/video-view/video-view.h>
+%include <dali-toolkit/devel-api/controls/popup/popup.h>
+
+%include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+%include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+
+%template(ItemIdContainer) std::vector<unsigned int>;
+%template(Item) std::pair<unsigned int, Dali::Actor>;
+%template(ItemContainer) std::vector<std::pair<unsigned int, Dali::Actor>>;
+%template(ActorContainer) std::vector<Dali::Actor>;
+%template(AccessibilityActionSignal) Dali::Signal<bool(Dali::Toolkit::AccessibilityManager&)>;
+%template(AccessibilityActionScrollSignal) Dali::Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>;
+%template(AccessibilityFocusOvershotSignal) Dali::Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>;
+%template(FocusChangedSignal) Dali::Signal<void(Dali::Actor, Dali::Actor)>;
+%template(KeyboardPreFocusChangeSignal) Dali::Signal<Dali::Actor(Dali::Actor, Dali::Actor, Dali::Toolkit::Control::KeyboardFocus::Direction)>;
+%template(FocusGroupChangedSignal) Dali::Signal<void(Dali::Actor, bool)>;
+%template(StyleChangedSignal) Dali::Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>;
+%template(ButtonSignal) Dali::Signal<bool(Dali::Toolkit::Button)>;
+%template(GaussianBlurViewSignal) Dali::Signal<void (Dali::Toolkit::GaussianBlurView)>;
+%template(PageTurnSignal) Dali::Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>;
+%template(PagePanSignal) Dali::Signal<void(Dali::Toolkit::PageTurnView)>;
+%template(ScrollViewSnapStartedSignal) Dali::Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>;
+%template(ScrollableSignal) Dali::Signal< void(const Dali::Vector2&)>;
+%template(TextEditorSignal) Dali::Signal<void(Dali::Toolkit::TextEditor)>;
+%template(TextFieldSignal) Dali::Signal<void(Dali::Toolkit::TextField)>;
+%template(ControlKeyEventSignal) Dali::Signal<bool(Dali::Toolkit::Control, const Dali::KeyEvent&)>;
+%template(KeyInputFocusSignal) Dali::Signal<void(Dali::Toolkit::Control)>;
+%template(VideoViewSignal) Dali::Signal<void(Dali::Toolkit::VideoView&)>;
+%template(SliderValueChangedSignal) Dali::Signal<bool(Dali::Toolkit::Slider, float)>;
+%template(SliderMarkReachedSignal) Dali::Signal<bool(Dali::Toolkit::Slider, int)>;
+%template(RulerPtr) Dali::IntrusivePtr<Dali::Toolkit::Ruler>;
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#if defined(SWIGCSHARP)
+%module(directors="1") NDalic
+#define DALI_EXPORT_API
+#define DALI_IMPORT_API
+#define DALI_INTERNAL
+#else
+%module Dali
+#endif
+
+%include exception.i
+
+%exception {
+ try {
+ $action
+ } catch (std::out_of_range& e) {
+ SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
+ } catch (std::exception& e) {
+ SWIG_exception(SWIG_RuntimeError,const_cast<char*>(e.what()));
+ } catch (...) {
+ SWIG_exception(SWIG_UnknownError,"unknown error");
+ }
+}
+
+#if defined(SWIGCSHARP)
+%{
+#define SWIGSTDCALL
+%}
+#endif
+
+%{
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/math/viewport.h>
+
+
+#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/adaptor-framework/window.h>
+#include <dali/public-api/adaptor-framework/style-change.h>
+#include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
+
+#include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/devel-api/controls/popup/popup.h>
+
+#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+
+#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
+
+// add here SWIG version check
+
+#if defined(_MSC_VER) // Microsoft Visual C++ 6.0
+// disable Swig-dependent warnings
+
+// 'identifier1' has C-linkage specified,
+// but returns UDT 'identifier2' which is incompatible with C
+#pragma warning(disable: 4190)
+
+// 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#pragma warning(disable: 4800)
+
+// debug info too long etc etc
+#pragma warning(disable: 4786)
+#endif
+%}
+
+%include stl.i
+%include exception.i
+%include typemaps.i
+%include std_common.i
+%include carrays.i
+
+%include cpointer.i
+%pointer_class(float, floatp);
+%pointer_class(int, intp);
+%pointer_class(double, doublep);
+%pointer_class(unsigned int, uintp);
+%pointer_class(unsigned short, ushortp);
+%pointer_cast(int, unsigned int, int_to_uint);
+
+%apply unsigned char { uint8_t };
+%apply unsigned short int { uint16_t };
+%apply unsigned int { uint32_t };
+%apply int { int32_t };
+
+#if defined(SWIGCSHARP)
+
+%typemap(ctype) void * "void *"
+%typemap(imtype) void * "System.IntPtr"
+%typemap(cstype) void * "System.IntPtr"
+%typemap(csin) void * "$csinput"
+%typemap(in) void * %{ $1 = $input; %}
+%typemap(out) void * %{ $result = $1; %}
+%typemap(csout) void * { return $imcall; }
+
+#endif
+
+#if defined(SWIGCSHARP)
+
+// string &
+%typemap(ctype) std::string & "char**"
+%typemap(imtype) std::string & "out string"
+%typemap(cstype) std::string & "out string"
+
+//C++
+%typemap(in, canthrow=1) std::string &
+%{
+ //typemap in
+ std::string temp;
+ $1 = &temp;
+%}
+
+%typemap(argout) std::string &
+%{
+ //Typemap argout in c++ file.
+ //This will convert c++ string to c# string
+ *$input = SWIG_csharp_string_callback($1->c_str());
+%}
+
+%typemap(argout) const std::string &
+%{
+ //argout typemap for const std::string&
+%}
+
+%typemap(csin) std::string & "out $csinput"
+
+%typemap(throws, canthrow=1) string &
+%{
+ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
+ return $null;
+%}
+
+#endif
+
+%ignore operator<<;
+%ignore *::GetImplementation();
+%ignore *::GetImplementation(Dali::BaseHandle&);
+
+%{
+using namespace Dali;
+using namespace Dali::Toolkit;
+%}
+
+//%feature("director") Dali::Internal::CustomActorImpl;
+//%feature("notabstract") Dali::Internal::CustomActorImpl;
+//%feature("director") Dali::Toolkit::Internal::Control;
+//%feature("notabstract") Dali::Toolkit::Internal::Control;
+%feature("notabstract") Dali::Toolkit::FixedRuler;
+%feature("notabstract") Dali::Toolkit::DefaultRuler;
+
+// Note... all the typemap declarations have to be included before the DALi C++ head files are include otherwise
+// they have no effect.
+
+%include signal-parameters.i
+%include signals.i
+
+%include events/actor-event.i
+%include events/accessibilitymanager-event.i
+%include events/application-event.i
+%include events/animation-event.i
+%include events/button-event.i
+%include events/builder-event.i
+%include events/control-event.i
+%include events/gaussian-blur-view-event.i
+%include events/image-event.i
+%include events/itemview-event.i
+%include events/keyboardFocusManager-event.i
+%include events/objectregistry-event.i
+%include events/popup-event.i
+%include events/pinchgesture-event.i
+%include events/pageturnview-event.i
+%include events/pangesture-event.i
+%include events/propertynotification-event.i
+%include events/longpressgesture-event.i
+%include events/resourceimage-event.i
+%include events/scrollable-event.i
+%include events/scrollbar-event.i
+%include events/scrollview-event.i
+%include events/slider-event.i
+%include events/stage-event.i
+%include events/stylemanager-event.i
+%include events/tapgesture-event.i
+%include events/texteditor-event.i
+%include events/textfield-event.i
+%include events/timer-event.i
+%include events/videoview-event.i
+
+%include dali-operator.i
+%include dali-core.i
+%include dali-adaptor.i
+%include dali-toolkit.i
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define ACCESSIBILITY_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+ %typemap(csimports) NameSpace::ClassName %{
+ using System;
+ using System.Runtime.InteropServices;
+%}
+
+%enddef
+
+
+%define ACCESSIBILITY_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+ %typemap(cscode) NameSpace::ClassName %{
+
+
+ /**
+ * @brief Event arguments that passed via StatusChanged signal
+ *
+ */
+ public class StatusChangedEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionNext signal
+ *
+ */
+ public class ActionNextEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionPrevious signal
+ *
+ */
+ public class ActionPreviousEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionActivate signal
+ *
+ */
+ public class ActionActivateEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionRead signal
+ *
+ */
+ public class ActionReadEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionOver signal
+ *
+ */
+ public class ActionOverEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionReadNext signal
+ *
+ */
+ public class ActionReadNextEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionReadPrevious signal
+ *
+ */
+ public class ActionReadPreviousEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionUp signal
+ *
+ */
+ public class ActionUpEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionDown signal
+ *
+ */
+ public class ActionDownEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionClearFocus signal
+ *
+ */
+ public class ActionClearFocusEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionBack signal
+ *
+ */
+ public class ActionBackEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionScrollUp signal
+ *
+ */
+ public class ActionScrollUpEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionScrollDown signal
+ *
+ */
+ public class ActionScrollDownEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionPageLeft signal
+ *
+ */
+ public class ActionPageLeftEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionPageRight signal
+ *
+ */
+ public class ActionPageRightEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionPageUp signal
+ *
+ */
+ public class ActionPageUpEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionPageDown signal
+ *
+ */
+ public class ActionPageDownEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionMoveToFirst signal
+ *
+ */
+ public class ActionMoveToFirstEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionMoveToLast signal
+ *
+ */
+ public class ActionMoveToLastEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionReadFromTop signal
+ *
+ */
+ public class ActionReadFromTopEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionReadFromNext signal
+ *
+ */
+ public class ActionReadFromNextEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionZoom signal
+ *
+ */
+ public class ActionZoomEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionReadIndicatorInformation signal
+ *
+ */
+ public class ActionReadIndicatorInformationEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionReadPauseResume signal
+ *
+ */
+ public class ActionReadPauseResumeEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionStartStop signal
+ *
+ */
+ public class ActionStartStopEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionScroll signal
+ *
+ */
+ public class ActionScrollEventArgs : EventArgs
+ {
+ private AccessibilityManager _accessibilityManager;
+ private TouchEvent _touchEvent;
+
+ public AccessibilityManager AccessibilityManager
+ {
+ get
+ {
+ return _accessibilityManager;
+ }
+ set
+ {
+ _accessibilityManager = value;
+ }
+ }
+
+ public TouchEvent TouchEvent
+ {
+ get
+ {
+ return _touchEvent;
+ }
+ set
+ {
+ _touchEvent = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via ActionPageUp signal
+ *
+ */
+ public class FocusChangedEventArgs : EventArgs
+ {
+ private Actor _actorCurrent;
+ private Actor _actorNext;
+
+ public Actor ActorCurrent
+ {
+ get
+ {
+ return _actorCurrent;
+ }
+ set
+ {
+ _actorCurrent = value;
+ }
+ }
+
+ public Actor ActorNext
+ {
+ get
+ {
+ return _actorNext;
+ }
+ set
+ {
+ _actorNext = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via FocusedActorActivated signal
+ *
+ */
+ public class FocusedActorActivatedEventArgs : EventArgs
+ {
+ private Actor _actor;
+
+
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via FocusOvershot signal
+ *
+ */
+ public class FocusOvershotEventArgs : EventArgs
+ {
+ private Actor _currentFocusedActor;
+ private AccessibilityManager.FocusOvershotDirection _focusOvershotDirection;
+
+ public Actor CurrentFocusedActor
+ {
+ get
+ {
+ return _currentFocusedActor;
+ }
+ set
+ {
+ _currentFocusedActor = value;
+ }
+ }
+
+ public AccessibilityManager.FocusOvershotDirection FocusOvershotDirection
+ {
+ get
+ {
+ return _focusOvershotDirection;
+ }
+ set
+ {
+ _focusOvershotDirection = value;
+ }
+ }
+ }
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool StatusChangedEventHandler(object source, StatusChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionNextEventHandler(object source, ActionNextEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionPreviousEventHandler(object source, ActionPreviousEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionActivateEventHandler(object source, ActionActivateEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionReadEventHandler(object source, ActionReadEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionOverEventHandler(object source, ActionOverEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionReadNextEventHandler(object source, ActionReadNextEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionReadPreviousEventHandler(object source, ActionReadPreviousEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionUpEventHandler(object source, ActionUpEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionDownEventHandler(object source, ActionDownEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionClearFocusEventHandler(object source, ActionClearFocusEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionBackEventHandler(object source, ActionBackEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionScrollUpEventHandler(object source, ActionScrollUpEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionScrollDownEventHandler(object source, ActionScrollDownEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionPageLeftEventHandler(object source, ActionPageLeftEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionPageRightEventHandler(object source, ActionPageRightEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionPageUpEventHandler(object source, ActionPageUpEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionPageDownEventHandler(object source, ActionPageDownEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionMoveToFirstEventHandler(object source, ActionMoveToFirstEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionMoveToLastEventHandler(object source, ActionMoveToLastEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionReadFromTopEventHandler(object source, ActionReadFromTopEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionReadFromNextEventHandler(object source, ActionReadFromNextEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionZoomEventHandler(object source, ActionZoomEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionReadIndicatorInformationEventHandler(object source, ActionReadIndicatorInformationEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionReadPauseResumeEventHandler(object source, ActionReadPauseResumeEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionStartStopEventHandler(object source, ActionStartStopEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ActionScrollEventHandler(object source, ActionScrollEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FocusChangedEventHandler(object source, FocusChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FocusedActorActivatedEventHandler(object source, FocusedActorActivatedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FocusOvershotEventHandler(object source, FocusOvershotEventArgs e);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool StatusChangedEventCallbackDelegate(IntPtr accessibilityManager);
+ private StatusChangedEventHandler _accessibilityManagerStatusChangedEventHandler;
+ private StatusChangedEventCallbackDelegate _accessibilityManagerStatusChangedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionNextEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionNextEventHandler _accessibilityManagerActionNextEventHandler;
+ private ActionNextEventCallbackDelegate _accessibilityManagerActionNextEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionPreviousEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionPreviousEventHandler _accessibilityManagerActionPreviousEventHandler;
+ private ActionPreviousEventCallbackDelegate _accessibilityManagerActionPreviousEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionActivateEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionActivateEventHandler _accessibilityManagerActionActivateEventHandler;
+ private ActionActivateEventCallbackDelegate _accessibilityManagerActionActivateEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionReadEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionReadEventHandler _accessibilityManagerActionReadEventHandler;
+ private ActionReadEventCallbackDelegate _accessibilityManagerActionReadEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionOverEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionOverEventHandler _accessibilityManagerActionOverEventHandler;
+ private ActionOverEventCallbackDelegate _accessibilityManagerActionOverEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionReadNextEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionReadNextEventHandler _accessibilityManagerActionReadNextEventHandler;
+ private ActionReadNextEventCallbackDelegate _accessibilityManagerActionReadNextEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionReadPreviousEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionReadPreviousEventHandler _accessibilityManagerActionReadPreviousEventHandler;
+ private ActionReadPreviousEventCallbackDelegate _accessibilityManagerActionReadPreviousEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionUpEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionUpEventHandler _accessibilityManagerActionUpEventHandler;
+ private ActionUpEventCallbackDelegate _accessibilityManagerActionUpEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionDownEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionDownEventHandler _accessibilityManagerActionDownEventHandler;
+ private ActionDownEventCallbackDelegate _accessibilityManagerActionDownEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionClearFocusEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionClearFocusEventHandler _accessibilityManagerActionClearFocusEventHandler;
+ private ActionClearFocusEventCallbackDelegate _accessibilityManagerActionClearFocusEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionBackEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionBackEventHandler _accessibilityManagerActionBackEventHandler;
+ private ActionBackEventCallbackDelegate _accessibilityManagerActionBackEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionScrollUpEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionScrollUpEventHandler _accessibilityManagerActionScrollUpEventHandler;
+ private ActionScrollUpEventCallbackDelegate _accessibilityManagerActionScrollUpEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionScrollDownEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionScrollDownEventHandler _accessibilityManagerActionScrollDownEventHandler;
+ private ActionScrollDownEventCallbackDelegate _accessibilityManagerActionScrollDownEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionPageLeftEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionPageLeftEventHandler _accessibilityManagerActionPageLeftEventHandler;
+ private ActionPageLeftEventCallbackDelegate _accessibilityManagerActionPageLeftEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionPageRightEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionPageRightEventHandler _accessibilityManagerActionPageRightEventHandler;
+ private ActionPageRightEventCallbackDelegate _accessibilityManagerActionPageRightEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionPageUpEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionPageUpEventHandler _accessibilityManagerActionPageUpEventHandler;
+ private ActionPageUpEventCallbackDelegate _accessibilityManagerActionPageUpEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionPageDownEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionPageDownEventHandler _accessibilityManagerActionPageDownEventHandler;
+ private ActionPageDownEventCallbackDelegate _accessibilityManagerActionPageDownEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionMoveToFirstEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionMoveToFirstEventHandler _accessibilityManagerActionMoveToFirstEventHandler;
+ private ActionMoveToFirstEventCallbackDelegate _accessibilityManagerActionMoveToFirstEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionMoveToLastEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionMoveToLastEventHandler _accessibilityManagerActionMoveToLastEventHandler;
+ private ActionMoveToLastEventCallbackDelegate _accessibilityManagerActionMoveToLastEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionReadFromTopEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionReadFromTopEventHandler _accessibilityManagerActionReadFromTopEventHandler;
+ private ActionReadFromTopEventCallbackDelegate _accessibilityManagerActionReadFromTopEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionReadFromNextEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionReadFromNextEventHandler _accessibilityManagerActionReadFromNextEventHandler;
+ private ActionReadFromNextEventCallbackDelegate _accessibilityManagerActionReadFromNextEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionZoomEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionZoomEventHandler _accessibilityManagerActionZoomEventHandler;
+ private ActionZoomEventCallbackDelegate _accessibilityManagerActionZoomEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionReadIndicatorInformationEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionReadIndicatorInformationEventHandler _accessibilityManagerActionReadIndicatorInformationEventHandler;
+ private ActionReadIndicatorInformationEventCallbackDelegate _accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionReadPauseResumeEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionReadPauseResumeEventHandler _accessibilityManagerActionReadPauseResumeEventHandler;
+ private ActionReadPauseResumeEventCallbackDelegate _accessibilityManagerActionReadPauseResumeEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionStartStopEventCallbackDelegate(IntPtr accessibilityManager);
+ private ActionStartStopEventHandler _accessibilityManagerActionStartStopEventHandler;
+ private ActionStartStopEventCallbackDelegate _accessibilityManagerActionStartStopEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ActionScrollEventCallbackDelegate(IntPtr accessibilityManager, IntPtr touchEvent);
+ private ActionScrollEventHandler _accessibilityManagerActionScrollEventHandler;
+ private ActionScrollEventCallbackDelegate _accessibilityManagerActionScrollEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FocusChangedEventCallbackDelegate(IntPtr actor1, IntPtr actor2);
+ private FocusChangedEventHandler _accessibilityManagerFocusChangedEventHandler;
+ private FocusChangedEventCallbackDelegate _accessibilityManagerFocusChangedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FocusedActorActivatedEventCallbackDelegate(IntPtr actor);
+ private FocusedActorActivatedEventHandler _accessibilityManagerFocusedActorActivatedEventHandler;
+ private FocusedActorActivatedEventCallbackDelegate _accessibilityManagerFocusedActorActivatedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FocusOvershotEventCallbackDelegate(IntPtr currentFocusedActor, AccessibilityManager.FocusOvershotDirection direction);
+ private FocusOvershotEventHandler _accessibilityManagerFocusOvershotEventHandler;
+ private FocusOvershotEventCallbackDelegate _accessibilityManagerFocusOvershotEventCallbackDelegate;
+
+ public event StatusChangedEventHandler StatusChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerStatusChangedEventHandler == null)
+ {
+ _accessibilityManagerStatusChangedEventHandler += value;
+
+ _accessibilityManagerStatusChangedEventCallbackDelegate = new StatusChangedEventCallbackDelegate(OnStatusChanged);
+ this.StatusChangedSignal().Connect(_accessibilityManagerStatusChangedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerStatusChangedEventHandler != null)
+ {
+ this.StatusChangedSignal().Disconnect(_accessibilityManagerStatusChangedEventCallbackDelegate);
+ }
+
+ _accessibilityManagerStatusChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager StatusChangedSignal
+ private bool OnStatusChanged(IntPtr data)
+ {
+ StatusChangedEventArgs e = new StatusChangedEventArgs();
+
+ // Populate all members of "e" (StatusChangedEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerStatusChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerStatusChangedEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionNextEventHandler ActionNext
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionNextEventHandler == null)
+ {
+ _accessibilityManagerActionNextEventHandler += value;
+
+ _accessibilityManagerActionNextEventCallbackDelegate = new ActionNextEventCallbackDelegate(OnActionNext);
+ this.ActionNextSignal().Connect(_accessibilityManagerActionNextEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionNextEventHandler != null)
+ {
+ this.ActionNextSignal().Disconnect(_accessibilityManagerActionNextEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionNextEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionNextSignal
+ private bool OnActionNext(IntPtr data)
+ {
+ ActionNextEventArgs e = new ActionNextEventArgs();
+
+ // Populate all members of "e" (ActionNextEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionNextEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionNextEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionPreviousEventHandler ActionPrevious
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionPreviousEventHandler == null)
+ {
+ _accessibilityManagerActionPreviousEventHandler += value;
+
+ _accessibilityManagerActionPreviousEventCallbackDelegate = new ActionPreviousEventCallbackDelegate(OnActionPrevious);
+ this.ActionPreviousSignal().Connect(_accessibilityManagerActionPreviousEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionPreviousEventHandler != null)
+ {
+ this.ActionPreviousSignal().Disconnect(_accessibilityManagerActionPreviousEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionPreviousEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionPreviousSignal
+ private bool OnActionPrevious(IntPtr data)
+ {
+ ActionPreviousEventArgs e = new ActionPreviousEventArgs();
+
+ // Populate all members of "e" (ActionPreviousEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionPreviousEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionPreviousEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionActivateEventHandler ActionActivate
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionActivateEventHandler == null)
+ {
+ _accessibilityManagerActionActivateEventHandler += value;
+
+ _accessibilityManagerActionActivateEventCallbackDelegate = new ActionActivateEventCallbackDelegate(OnActionActivate);
+ this.ActionActivateSignal().Connect(_accessibilityManagerActionActivateEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionActivateEventHandler != null)
+ {
+ this.ActionActivateSignal().Disconnect(_accessibilityManagerActionActivateEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionActivateEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionActivateSignal
+ private bool OnActionActivate(IntPtr data)
+ {
+ ActionActivateEventArgs e = new ActionActivateEventArgs();
+
+ // Populate all members of "e" (ActionActivateEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionActivateEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionActivateEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionReadEventHandler ActionRead
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionReadEventHandler == null)
+ {
+ _accessibilityManagerActionReadEventHandler += value;
+
+ _accessibilityManagerActionReadEventCallbackDelegate = new ActionReadEventCallbackDelegate(OnActionRead);
+ this.ActionReadSignal().Connect(_accessibilityManagerActionReadEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionReadEventHandler != null)
+ {
+ this.ActionReadSignal().Disconnect(_accessibilityManagerActionReadEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionReadEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionReadSignal
+ private bool OnActionRead(IntPtr data)
+ {
+ ActionReadEventArgs e = new ActionReadEventArgs();
+
+ // Populate all members of "e" (ActionReadEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionReadEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionReadEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionOverEventHandler ActionOver
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionOverEventHandler == null)
+ {
+ _accessibilityManagerActionOverEventHandler += value;
+
+ _accessibilityManagerActionOverEventCallbackDelegate = new ActionOverEventCallbackDelegate(OnActionOver);
+ this.ActionOverSignal().Connect(_accessibilityManagerActionOverEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionOverEventHandler != null)
+ {
+ this.ActionOverSignal().Disconnect(_accessibilityManagerActionOverEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionOverEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionOverSignal
+ private bool OnActionOver(IntPtr data)
+ {
+ ActionOverEventArgs e = new ActionOverEventArgs();
+
+ // Populate all members of "e" (ActionOverEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionOverEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionOverEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionReadNextEventHandler ActionReadNext
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionReadNextEventHandler == null)
+ {
+ _accessibilityManagerActionReadNextEventHandler += value;
+
+ _accessibilityManagerActionReadNextEventCallbackDelegate = new ActionReadNextEventCallbackDelegate(OnActionReadNext);
+ this.ActionReadNextSignal().Connect(_accessibilityManagerActionReadNextEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionReadNextEventHandler != null)
+ {
+ this.ActionReadNextSignal().Disconnect(_accessibilityManagerActionReadNextEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionReadNextEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionReadNextSignal
+ private bool OnActionReadNext(IntPtr data)
+ {
+ ActionReadNextEventArgs e = new ActionReadNextEventArgs();
+
+ // Populate all members of "e" (ActionReadNextEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionReadNextEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionReadNextEventHandler(this, e);
+ }
+ return false;
+ }
+
+
+ public event ActionReadPreviousEventHandler ActionReadPrevious
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionReadPreviousEventHandler == null)
+ {
+ _accessibilityManagerActionReadPreviousEventHandler += value;
+
+ _accessibilityManagerActionReadPreviousEventCallbackDelegate = new ActionReadPreviousEventCallbackDelegate(OnActionReadPrevious);
+ this.ActionReadPreviousSignal().Connect(_accessibilityManagerActionReadPreviousEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionReadPreviousEventHandler != null)
+ {
+ this.ActionReadPreviousSignal().Disconnect(_accessibilityManagerActionReadPreviousEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionReadPreviousEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionReadPreviousSignal
+ private bool OnActionReadPrevious(IntPtr data)
+ {
+ ActionReadPreviousEventArgs e = new ActionReadPreviousEventArgs();
+
+ // Populate all members of "e" (ActionReadPreviousEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionReadPreviousEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionReadPreviousEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionUpEventHandler ActionUp
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionUpEventHandler == null)
+ {
+ _accessibilityManagerActionUpEventHandler += value;
+
+ _accessibilityManagerActionUpEventCallbackDelegate = new ActionUpEventCallbackDelegate(OnActionUp);
+ this.ActionUpSignal().Connect(_accessibilityManagerActionUpEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionUpEventHandler != null)
+ {
+ this.ActionUpSignal().Disconnect(_accessibilityManagerActionUpEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionUpEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionUpSignal
+ private bool OnActionUp(IntPtr data)
+ {
+ ActionUpEventArgs e = new ActionUpEventArgs();
+
+ // Populate all members of "e" (ActionUpEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionUpEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionUpEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionDownEventHandler ActionDown
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionDownEventHandler == null)
+ {
+ _accessibilityManagerActionDownEventHandler += value;
+
+ _accessibilityManagerActionDownEventCallbackDelegate = new ActionDownEventCallbackDelegate(OnActionDown);
+ this.ActionDownSignal().Connect(_accessibilityManagerActionDownEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionDownEventHandler != null)
+ {
+ this.ActionDownSignal().Disconnect(_accessibilityManagerActionDownEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionDownEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionDownSignal
+ private bool OnActionDown(IntPtr data)
+ {
+ ActionDownEventArgs e = new ActionDownEventArgs();
+
+ // Populate all members of "e" (ActionDownEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionDownEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionDownEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionClearFocusEventHandler ActionClearFocus
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionClearFocusEventHandler == null)
+ {
+ _accessibilityManagerActionClearFocusEventHandler += value;
+
+ _accessibilityManagerActionClearFocusEventCallbackDelegate = new ActionClearFocusEventCallbackDelegate(OnActionClearFocus);
+ this.ActionClearFocusSignal().Connect(_accessibilityManagerActionClearFocusEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionClearFocusEventHandler != null)
+ {
+ this.ActionClearFocusSignal().Disconnect(_accessibilityManagerActionClearFocusEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionClearFocusEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionClearFocusSignal
+ private bool OnActionClearFocus(IntPtr data)
+ {
+ ActionClearFocusEventArgs e = new ActionClearFocusEventArgs();
+
+ // Populate all members of "e" (ActionClearFocusEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionClearFocusEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionClearFocusEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionBackEventHandler ActionBack
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionBackEventHandler == null)
+ {
+ _accessibilityManagerActionBackEventHandler += value;
+
+ _accessibilityManagerActionBackEventCallbackDelegate = new ActionBackEventCallbackDelegate(OnActionBack);
+ this.ActionBackSignal().Connect(_accessibilityManagerActionBackEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionBackEventHandler != null)
+ {
+ this.ActionBackSignal().Disconnect(_accessibilityManagerActionBackEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionBackEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionBackSignal
+ private bool OnActionBack(IntPtr data)
+ {
+ ActionBackEventArgs e = new ActionBackEventArgs();
+
+ // Populate all members of "e" (ActionBackEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionBackEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionBackEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionScrollUpEventHandler ActionScrollUp
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionScrollUpEventHandler == null)
+ {
+ _accessibilityManagerActionScrollUpEventHandler += value;
+
+ _accessibilityManagerActionScrollUpEventCallbackDelegate = new ActionScrollUpEventCallbackDelegate(OnActionScrollUp);
+ this.ActionScrollUpSignal().Connect(_accessibilityManagerActionScrollUpEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionScrollUpEventHandler != null)
+ {
+ this.ActionScrollUpSignal().Disconnect(_accessibilityManagerActionScrollUpEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionScrollUpEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionScrollUpSignal
+ private bool OnActionScrollUp(IntPtr data)
+ {
+ ActionScrollUpEventArgs e = new ActionScrollUpEventArgs();
+
+ // Populate all members of "e" (ActionScrollUpEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionScrollUpEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionScrollUpEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionScrollDownEventHandler ActionScrollDown
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionScrollDownEventHandler == null)
+ {
+ _accessibilityManagerActionScrollDownEventHandler += value;
+
+ _accessibilityManagerActionScrollDownEventCallbackDelegate = new ActionScrollDownEventCallbackDelegate(OnActionScrollDown);
+ this.ActionScrollDownSignal().Connect(_accessibilityManagerActionScrollDownEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionScrollDownEventHandler != null)
+ {
+ this.ActionScrollDownSignal().Disconnect(_accessibilityManagerActionScrollDownEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionScrollDownEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionScrollDownSignal
+ private bool OnActionScrollDown(IntPtr data)
+ {
+ ActionScrollDownEventArgs e = new ActionScrollDownEventArgs();
+
+ // Populate all members of "e" (ActionScrollDownEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionScrollDownEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionScrollDownEventHandler(this, e);
+ }
+ return false;
+ }
+
+
+ public event ActionPageLeftEventHandler ActionPageLeft
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionPageLeftEventHandler == null)
+ {
+ _accessibilityManagerActionPageLeftEventHandler += value;
+
+ _accessibilityManagerActionPageLeftEventCallbackDelegate = new ActionPageLeftEventCallbackDelegate(OnActionPageLeft);
+ this.ActionPageLeftSignal().Connect(_accessibilityManagerActionPageLeftEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionPageLeftEventHandler != null)
+ {
+ this.ActionPageLeftSignal().Disconnect(_accessibilityManagerActionPageLeftEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionPageLeftEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionPageLeftSignal
+ private bool OnActionPageLeft(IntPtr data)
+ {
+ ActionPageLeftEventArgs e = new ActionPageLeftEventArgs();
+
+ // Populate all members of "e" (ActionPageLeftEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionPageLeftEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionPageLeftEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionPageRightEventHandler ActionPageRight
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionPageRightEventHandler == null)
+ {
+ _accessibilityManagerActionPageRightEventHandler += value;
+
+ _accessibilityManagerActionPageRightEventCallbackDelegate = new ActionPageRightEventCallbackDelegate(OnActionPageRight);
+ this.ActionPageRightSignal().Connect(_accessibilityManagerActionPageRightEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionPageRightEventHandler != null)
+ {
+ this.ActionPageRightSignal().Disconnect(_accessibilityManagerActionPageRightEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionPageRightEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionPageRightSignal
+ private bool OnActionPageRight(IntPtr data)
+ {
+ ActionPageRightEventArgs e = new ActionPageRightEventArgs();
+
+ // Populate all members of "e" (ActionPageRightEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionPageRightEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionPageRightEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionPageUpEventHandler ActionPageUp
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionPageUpEventHandler == null)
+ {
+ _accessibilityManagerActionPageUpEventHandler += value;
+
+ _accessibilityManagerActionPageUpEventCallbackDelegate = new ActionPageUpEventCallbackDelegate(OnActionPageUp);
+ this.ActionPageUpSignal().Connect(_accessibilityManagerActionPageUpEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionPageUpEventHandler != null)
+ {
+ this.ActionPageUpSignal().Disconnect(_accessibilityManagerActionPageUpEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionPageUpEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionPageUpSignal
+ private bool OnActionPageUp(IntPtr data)
+ {
+ ActionPageUpEventArgs e = new ActionPageUpEventArgs();
+
+ // Populate all members of "e" (ActionPageUpEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionPageUpEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionPageUpEventHandler(this, e);
+ }
+ return false;
+ }
+
+
+ public event ActionPageDownEventHandler ActionPageDown
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionPageDownEventHandler == null)
+ {
+ _accessibilityManagerActionPageDownEventHandler += value;
+
+ _accessibilityManagerActionPageDownEventCallbackDelegate = new ActionPageDownEventCallbackDelegate(OnActionPageDown);
+ this.ActionPageDownSignal().Connect(_accessibilityManagerActionPageDownEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionPageDownEventHandler != null)
+ {
+ this.ActionPageDownSignal().Disconnect(_accessibilityManagerActionPageDownEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionPageDownEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionPageDownSignal
+ private bool OnActionPageDown(IntPtr data)
+ {
+ ActionPageDownEventArgs e = new ActionPageDownEventArgs();
+
+ // Populate all members of "e" (ActionPageDownEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionPageDownEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionPageDownEventHandler(this, e);
+ }
+ return false;
+ }
+
+
+ public event ActionMoveToFirstEventHandler ActionMoveToFirst
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionMoveToFirstEventHandler == null)
+ {
+ _accessibilityManagerActionMoveToFirstEventHandler += value;
+
+ _accessibilityManagerActionMoveToFirstEventCallbackDelegate = new ActionMoveToFirstEventCallbackDelegate(OnActionMoveToFirst);
+ this.ActionMoveToFirstSignal().Connect(_accessibilityManagerActionMoveToFirstEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionMoveToFirstEventHandler != null)
+ {
+ this.ActionMoveToFirstSignal().Disconnect(_accessibilityManagerActionMoveToFirstEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionMoveToFirstEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionMoveToFirstSignal
+ private bool OnActionMoveToFirst(IntPtr data)
+ {
+ ActionMoveToFirstEventArgs e = new ActionMoveToFirstEventArgs();
+
+ // Populate all members of "e" (ActionMoveToFirstEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionMoveToFirstEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionMoveToFirstEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionMoveToLastEventHandler ActionMoveToLast
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionMoveToLastEventHandler == null)
+ {
+ _accessibilityManagerActionMoveToLastEventHandler += value;
+
+ _accessibilityManagerActionMoveToLastEventCallbackDelegate = new ActionMoveToLastEventCallbackDelegate(OnActionMoveToLast);
+ this.ActionMoveToLastSignal().Connect(_accessibilityManagerActionMoveToLastEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionMoveToLastEventHandler != null)
+ {
+ this.ActionMoveToLastSignal().Disconnect(_accessibilityManagerActionMoveToLastEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionMoveToLastEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionMoveToLastSignal
+ private bool OnActionMoveToLast(IntPtr data)
+ {
+ ActionMoveToLastEventArgs e = new ActionMoveToLastEventArgs();
+
+ // Populate all members of "e" (ActionMoveToLastEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionMoveToLastEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionMoveToLastEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionReadFromTopEventHandler ActionReadFromTop
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionReadFromTopEventHandler == null)
+ {
+ _accessibilityManagerActionReadFromTopEventHandler += value;
+
+ _accessibilityManagerActionReadFromTopEventCallbackDelegate = new ActionReadFromTopEventCallbackDelegate(OnActionReadFromTop);
+ this.ActionReadFromTopSignal().Connect(_accessibilityManagerActionReadFromTopEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionReadFromTopEventHandler != null)
+ {
+ this.ActionReadFromTopSignal().Disconnect(_accessibilityManagerActionReadFromTopEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionReadFromTopEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionReadFromTopSignal
+ private bool OnActionReadFromTop(IntPtr data)
+ {
+ ActionReadFromTopEventArgs e = new ActionReadFromTopEventArgs();
+
+ // Populate all members of "e" (ActionReadFromTopEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionReadFromTopEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionReadFromTopEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionReadFromNextEventHandler ActionReadFromNext
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionReadFromNextEventHandler == null)
+ {
+ _accessibilityManagerActionReadFromNextEventHandler += value;
+
+ _accessibilityManagerActionReadFromNextEventCallbackDelegate = new ActionReadFromNextEventCallbackDelegate(OnActionReadFromNext);
+ this.ActionReadFromNextSignal().Connect(_accessibilityManagerActionReadFromNextEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionReadFromNextEventHandler != null)
+ {
+ this.ActionReadFromNextSignal().Disconnect(_accessibilityManagerActionReadFromNextEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionReadFromNextEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionReadFromNextSignal
+ private bool OnActionReadFromNext(IntPtr data)
+ {
+ ActionReadFromNextEventArgs e = new ActionReadFromNextEventArgs();
+
+ // Populate all members of "e" (ActionReadFromNextEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionReadFromNextEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionReadFromNextEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionZoomEventHandler ActionZoom
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionZoomEventHandler == null)
+ {
+ _accessibilityManagerActionZoomEventHandler += value;
+
+ _accessibilityManagerActionZoomEventCallbackDelegate = new ActionZoomEventCallbackDelegate(OnActionZoom);
+ this.ActionZoomSignal().Connect(_accessibilityManagerActionZoomEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionZoomEventHandler != null)
+ {
+ this.ActionZoomSignal().Disconnect(_accessibilityManagerActionZoomEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionZoomEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionZoomSignal
+ private bool OnActionZoom(IntPtr data)
+ {
+ ActionZoomEventArgs e = new ActionZoomEventArgs();
+
+ // Populate all members of "e" (ActionZoomEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionZoomEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionZoomEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionReadIndicatorInformationEventHandler ActionReadIndicatorInformation
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionReadIndicatorInformationEventHandler == null)
+ {
+ _accessibilityManagerActionReadIndicatorInformationEventHandler += value;
+
+ _accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate = new ActionReadIndicatorInformationEventCallbackDelegate(OnActionReadIndicatorInformation);
+ this.ActionReadIndicatorInformationSignal().Connect(_accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionReadIndicatorInformationEventHandler != null)
+ {
+ this.ActionReadIndicatorInformationSignal().Disconnect(_accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionReadIndicatorInformationEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionReadIndicatorInformationSignal
+ private bool OnActionReadIndicatorInformation(IntPtr data)
+ {
+ ActionReadIndicatorInformationEventArgs e = new ActionReadIndicatorInformationEventArgs();
+
+ // Populate all members of "e" (ActionReadIndicatorInformationEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionReadIndicatorInformationEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionReadIndicatorInformationEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionReadPauseResumeEventHandler ActionReadPauseResume
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionReadPauseResumeEventHandler == null)
+ {
+ _accessibilityManagerActionReadPauseResumeEventHandler += value;
+
+ _accessibilityManagerActionReadPauseResumeEventCallbackDelegate = new ActionReadPauseResumeEventCallbackDelegate(OnActionReadPauseResume);
+ this.ActionReadPauseResumeSignal().Connect(_accessibilityManagerActionReadPauseResumeEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionReadPauseResumeEventHandler != null)
+ {
+ this.ActionReadPauseResumeSignal().Disconnect(_accessibilityManagerActionReadPauseResumeEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionReadPauseResumeEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionReadPauseResumeSignal
+ private bool OnActionReadPauseResume(IntPtr data)
+ {
+ ActionReadPauseResumeEventArgs e = new ActionReadPauseResumeEventArgs();
+
+ // Populate all members of "e" (ActionReadPauseResumeEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionReadPauseResumeEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionReadPauseResumeEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionStartStopEventHandler ActionStartStop
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionStartStopEventHandler == null)
+ {
+ _accessibilityManagerActionStartStopEventHandler += value;
+
+ _accessibilityManagerActionStartStopEventCallbackDelegate = new ActionStartStopEventCallbackDelegate(OnActionStartStop);
+ this.ActionStartStopSignal().Connect(_accessibilityManagerActionStartStopEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionStartStopEventHandler != null)
+ {
+ this.ActionStartStopSignal().Disconnect(_accessibilityManagerActionStartStopEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionStartStopEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionStartStopSignal
+ private bool OnActionStartStop(IntPtr data)
+ {
+ ActionStartStopEventArgs e = new ActionStartStopEventArgs();
+
+ // Populate all members of "e" (ActionStartStopEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data);
+
+ if (_accessibilityManagerActionStartStopEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionStartStopEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event ActionScrollEventHandler ActionScroll
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerActionScrollEventHandler == null)
+ {
+ _accessibilityManagerActionScrollEventHandler += value;
+
+ _accessibilityManagerActionScrollEventCallbackDelegate = new ActionScrollEventCallbackDelegate(OnActionScroll);
+ this.ActionScrollSignal().Connect(_accessibilityManagerActionScrollEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerActionScrollEventHandler != null)
+ {
+ this.ActionScrollSignal().Disconnect(_accessibilityManagerActionScrollEventCallbackDelegate);
+ }
+
+ _accessibilityManagerActionScrollEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager ActionScrollSignal
+ private bool OnActionScroll(IntPtr accessibilityManager, IntPtr touchEvent)
+ {
+ ActionScrollEventArgs e = new ActionScrollEventArgs();
+
+ // Populate all members of "e" (ActionScrollEventArgs) with real data
+ e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(accessibilityManager);
+ e.TouchEvent = TouchEvent.GetTouchEventFromPtr(touchEvent);
+
+ if (_accessibilityManagerActionScrollEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _accessibilityManagerActionScrollEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event FocusChangedEventHandler FocusChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerFocusChangedEventHandler == null)
+ {
+ _accessibilityManagerFocusChangedEventHandler += value;
+
+ _accessibilityManagerFocusChangedEventCallbackDelegate = new FocusChangedEventCallbackDelegate(OnFocusChanged);
+ this.FocusChangedSignal().Connect(_accessibilityManagerFocusChangedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerFocusChangedEventHandler != null)
+ {
+ this.FocusChangedSignal().Disconnect(_accessibilityManagerFocusChangedEventCallbackDelegate);
+ }
+
+ _accessibilityManagerFocusChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager FocusChangedSignal
+ private void OnFocusChanged(IntPtr actor1, IntPtr actor2)
+ {
+ FocusChangedEventArgs e = new FocusChangedEventArgs();
+
+ // Populate all members of "e" (FocusChangedEventArgs) with real data
+ e.ActorCurrent = Actor.GetActorFromPtr(actor1);
+ e.ActorNext = Actor.GetActorFromPtr(actor2);
+
+ if (_accessibilityManagerFocusChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _accessibilityManagerFocusChangedEventHandler(this, e);
+ }
+ }
+
+ public event FocusedActorActivatedEventHandler FocusedActorActivated
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerFocusedActorActivatedEventHandler == null)
+ {
+ _accessibilityManagerFocusedActorActivatedEventHandler += value;
+
+ _accessibilityManagerFocusedActorActivatedEventCallbackDelegate = new FocusedActorActivatedEventCallbackDelegate(OnFocusedActorActivated);
+ this.FocusedActorActivatedSignal().Connect(_accessibilityManagerFocusedActorActivatedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerFocusedActorActivatedEventHandler != null)
+ {
+ this.FocusedActorActivatedSignal().Disconnect(_accessibilityManagerFocusedActorActivatedEventCallbackDelegate);
+ }
+
+ _accessibilityManagerFocusedActorActivatedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager FocusedActorActivatedSignal
+ private void OnFocusedActorActivated(IntPtr actor)
+ {
+ FocusedActorActivatedEventArgs e = new FocusedActorActivatedEventArgs();
+
+ // Populate all members of "e" (FocusedActorActivatedEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+
+ if (_accessibilityManagerFocusedActorActivatedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _accessibilityManagerFocusedActorActivatedEventHandler(this, e);
+ }
+ }
+
+
+ public event FocusOvershotEventHandler FocusOvershot
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_accessibilityManagerFocusOvershotEventHandler == null)
+ {
+ _accessibilityManagerFocusOvershotEventHandler += value;
+
+ _accessibilityManagerFocusOvershotEventCallbackDelegate = new FocusOvershotEventCallbackDelegate(OnFocusOvershot);
+ this.FocusOvershotSignal().Connect(_accessibilityManagerFocusOvershotEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_accessibilityManagerFocusOvershotEventHandler != null)
+ {
+ this.FocusOvershotSignal().Disconnect(_accessibilityManagerFocusOvershotEventCallbackDelegate);
+ }
+
+ _accessibilityManagerFocusOvershotEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for AccessibilityManager FocusOvershotSignal
+ private void OnFocusOvershot(IntPtr currentFocusedActor, AccessibilityManager.FocusOvershotDirection direction)
+ {
+ FocusOvershotEventArgs e = new FocusOvershotEventArgs();
+
+ // Populate all members of "e" (FocusOvershotEventArgs) with real data
+ e.CurrentFocusedActor = Actor.GetActorFromPtr(currentFocusedActor);
+ e.FocusOvershotDirection = direction;
+
+ if (_accessibilityManagerFocusOvershotEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _accessibilityManagerFocusOvershotEventHandler(this, e);
+ }
+ }
+
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ %}
+ %enddef
+
+%define DALI_ACCESSIBILITY_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ ACCESSIBILITY_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ ACCESSIBILITY_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+ %enddef
+
+ namespace Dali
+{
+ DALI_ACCESSIBILITY_EVENTHANDLER_PARAM( Dali::Toolkit, AccessibilityManager);
+}
+
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+ using System;
+ using System.Runtime.InteropServices;
+%}
+
+%enddef
+
+%define ACTOR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+ %typemap(cscode) NameSpace::ClassName %{
+
+
+ /**
+ * @brief Event arguments that passed via Touch signal
+ *
+ */
+ public class TouchEventArgs : EventArgs
+ {
+ private Actor _actor;
+ private TouchData _touchData;
+
+ /**
+ * @brief Actor - is the actor that is being touched
+ *
+ */
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+
+ /**
+ * @brief TouchData - contains the information of touch points
+ *
+ */
+ public TouchData TouchData
+ {
+ get
+ {
+ return _touchData;
+ }
+ set
+ {
+ _touchData = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via Hover signal
+ *
+ */
+ public class HoverEventArgs : EventArgs
+ {
+ private Actor _actor;
+ private HoverEvent _hoverEvent;
+
+ /**
+ * @brief Actor - is the actor that is being hovered
+ *
+ */
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+
+ /**
+ * @brief HoverEvent - contains touch points that represent the points
+ * that are currently being hovered or the points where a hover has stopped
+ *
+ */
+ public HoverEvent HoverEvent
+ {
+ get
+ {
+ return _hoverEvent;
+ }
+ set
+ {
+ _hoverEvent = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via Wheel signal
+ *
+ */
+ public class WheelEventArgs : EventArgs
+ {
+ private Actor _actor;
+ private WheelEvent _wheelEvent;
+
+ /**
+ * @brief Actor - is the actor that is being wheeled
+ *
+ */
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+
+ /**
+ * @brief WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
+ *
+ */
+ public WheelEvent WheelEvent
+ {
+ get
+ {
+ return _wheelEvent;
+ }
+ set
+ {
+ _wheelEvent = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OnStage signal
+ *
+ */
+ public class OnStageEventArgs : EventArgs
+ {
+ private Actor _actor;
+
+ /**
+ * @brief Actor - is the actor that is being connected to the stage
+ *
+ */
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OffStage signal
+ *
+ */
+ public class OffStageEventArgs : EventArgs
+ {
+ private Actor _actor;
+
+ /**
+ * @brief Actor - is the actor that is being disconnected from the stage
+ *
+ */
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via OnRelayout signal
+ *
+ */
+ public class OnRelayoutEventArgs : EventArgs
+ {
+ private Actor _actor;
+
+ /**
+ * @brief Actor - is the actor that is being resized upon relayout
+ *
+ */
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+ }
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool TouchEventHandler(object source, TouchEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool HoverEventHandler(object source, HoverEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool WheelEventHandler(object source, WheelEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void OnStageEventHandler(object source, OnStageEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void OffStageEventHandler(object source, OffStageEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void OnRelayoutEventHandler(object source, OnRelayoutEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool TouchCallbackDelegate(IntPtr actor, IntPtr touchData);
+ private TouchEventHandler _actorTouchDataEventHandler;
+ private TouchCallbackDelegate _actorTouchDataCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool HoverEventCallbackDelegate(IntPtr actor, IntPtr hoverEvent);
+ private HoverEventHandler _actorHoverEventHandler;
+ private HoverEventCallbackDelegate _actorHoverEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool WheelEventCallbackDelegate(IntPtr actor, IntPtr wheelEvent);
+ private WheelEventHandler _actorWheelEventHandler;
+ private WheelEventCallbackDelegate _actorWheelEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OnStageEventCallbackDelegate(IntPtr actor);
+ private OnStageEventHandler _actorOnStageEventHandler;
+ private OnStageEventCallbackDelegate _actorOnStageEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OffStageEventCallbackDelegate(IntPtr actor);
+ private OffStageEventHandler _actorOffStageEventHandler;
+ private OffStageEventCallbackDelegate _actorOffStageEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OnRelayoutEventCallbackDelegate(IntPtr actor);
+ private OnRelayoutEventHandler _actorOnRelayoutEventHandler;
+ private OnRelayoutEventCallbackDelegate _actorOnRelayoutEventCallbackDelegate;
+
+ /**
+ * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of TouchEventHandler) provided by the user.
+ * Touched signal is emitted when touch input is received.
+ */
+ public event TouchEventHandler Touched
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_actorTouchDataEventHandler == null)
+ {
+ _actorTouchDataEventHandler += value;
+
+ _actorTouchDataCallbackDelegate = new TouchCallbackDelegate(OnTouch);
+ this.TouchSignal().Connect(_actorTouchDataCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_actorTouchDataEventHandler != null)
+ {
+ this.TouchSignal().Disconnect(_actorTouchDataCallbackDelegate);
+ }
+
+ _actorTouchDataEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Actor TouchSignal
+ private bool OnTouch(IntPtr actor, IntPtr touchData)
+ {
+ TouchEventArgs e = new TouchEventArgs();
+
+ // Populate all members of "e" (TouchEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+ e.TouchData = Dali.TouchData.GetTouchDataFromPtr(touchData);
+
+ if (_actorTouchDataEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _actorTouchDataEventHandler(this, e);
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of HoverEventHandler) provided by the user.
+ * Hovered signal is emitted when hover input is received.
+ */
+ public event HoverEventHandler Hovered
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_actorHoverEventHandler == null)
+ {
+ _actorHoverEventHandler += value;
+
+ _actorHoverEventCallbackDelegate = new HoverEventCallbackDelegate(OnHoverEvent);
+ this.HoveredSignal().Connect(_actorHoverEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_actorHoverEventHandler != null)
+ {
+ this.HoveredSignal().Disconnect(_actorHoverEventCallbackDelegate);
+ }
+
+ _actorHoverEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Actor Hover signal
+ private bool OnHoverEvent(IntPtr actor, IntPtr hoverEvent)
+ {
+ HoverEventArgs e = new HoverEventArgs();
+
+ // Populate all members of "e" (HoverEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+ e.HoverEvent = Dali.HoverEvent.GetHoverEventFromPtr(hoverEvent);
+
+ if (_actorHoverEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _actorHoverEventHandler(this, e);
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of WheelEventHandler) provided by the user.
+ * WheelMoved signal is emitted when wheel event is received.
+ */
+ public event WheelEventHandler WheelMoved
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_actorWheelEventHandler == null)
+ {
+ _actorWheelEventHandler += value;
+
+ _actorWheelEventCallbackDelegate = new WheelEventCallbackDelegate(OnWheelEvent);
+ this.WheelEventSignal().Connect(_actorWheelEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_actorWheelEventHandler != null)
+ {
+ this.WheelEventSignal().Disconnect(_actorWheelEventCallbackDelegate);
+ }
+
+ _actorWheelEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Actor Wheel signal
+ private bool OnWheelEvent(IntPtr actor, IntPtr wheelEvent)
+ {
+ WheelEventArgs e = new WheelEventArgs();
+
+ // Populate all members of "e" (WheelEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+ e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr(wheelEvent);
+
+ if (_actorWheelEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _actorWheelEventHandler(this, e);
+ }
+
+ return false;
+ }
+
+ /**
+ * @brief Event for OnStage signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OnStageEventHandler) provided by the user.
+ * OnStage signal is emitted after the actor has been connected to the stage.
+ */
+ public event OnStageEventHandler OnStageEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_actorOnStageEventHandler == null)
+ {
+ _actorOnStageEventHandler += value;
+
+ _actorOnStageEventCallbackDelegate = new OnStageEventCallbackDelegate(OnStage);
+ this.OnStageSignal().Connect(_actorOnStageEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_actorOnStageEventHandler != null)
+ {
+ this.OnStageSignal().Disconnect(_actorOnStageEventCallbackDelegate);
+ }
+
+ _actorOnStageEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Actor OnStage signal
+ private void OnStage(IntPtr data)
+ {
+ OnStageEventArgs e = new OnStageEventArgs();
+
+ // Populate all members of "e" (OnStageEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(data);
+
+ if (_actorOnStageEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _actorOnStageEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for OffStage signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OffStageEventHandler) provided by the user.
+ * OffStage signal is emitted after the actor has been disconnected from the stage.
+ */
+ public event OffStageEventHandler OffStageEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_actorOffStageEventHandler == null)
+ {
+ _actorOffStageEventHandler += value;
+
+ _actorOffStageEventCallbackDelegate = new OffStageEventCallbackDelegate(OffStage);
+ this.OnStageSignal().Connect(_actorOffStageEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_actorOffStageEventHandler != null)
+ {
+ this.OnStageSignal().Disconnect(_actorOffStageEventCallbackDelegate);
+ }
+
+ _actorOffStageEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Actor OffStage signal
+ private void OffStage(IntPtr data)
+ {
+ OffStageEventArgs e = new OffStageEventArgs();
+
+ // Populate all members of "e" (OffStageEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(data);
+
+ if (_actorOffStageEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _actorOffStageEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of OnRelayoutEventHandler) provided by the user.
+ * OnRelayout signal is emitted after the size has been set on the actor during relayout.
+ */
+ public event OnRelayoutEventHandler OnRelayoutEvent
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_actorOnRelayoutEventHandler == null)
+ {
+ _actorOnRelayoutEventHandler += value;
+
+ _actorOnRelayoutEventCallbackDelegate = new OnRelayoutEventCallbackDelegate(OnRelayout);
+ this.OnRelayoutSignal().Connect(_actorOnRelayoutEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_actorOnRelayoutEventHandler != null)
+ {
+ this.OnRelayoutSignal().Disconnect(_actorOnRelayoutEventCallbackDelegate);
+ }
+
+ _actorOnRelayoutEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Actor OnRelayout signal
+ private void OnRelayout(IntPtr data)
+ {
+ OnRelayoutEventArgs e = new OnRelayoutEventArgs();
+
+ // Populate all members of "e" (OnRelayoutEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(data);
+
+ if (_actorOnRelayoutEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _actorOnRelayoutEventHandler(this, e);
+ }
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ public IntPtr GetPtrfrom ## ClassName ()
+ {
+ return (IntPtr)swigCPtr;
+ }
+ %}
+
+ %enddef
+
+%define DALI_ACTOR_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ ACTOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+ %enddef
+
+ namespace Dali
+{
+ DALI_ACTOR_EVENTHANDLER_PARAM( Dali, Actor);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define Animation_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+ %typemap(csimports) NameSpace::ClassName %{
+ using System;
+ using System.Runtime.InteropServices;
+
+ %}
+ %enddef
+
+%define Animation_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+ %typemap(cscode) NameSpace::ClassName %{
+
+
+ /**
+ * @brief Event arguments that passed via Finished signal
+ *
+ */
+ public class FinishedEventArgs : EventArgs
+ {
+ private Animation _animation;
+
+ /**
+ * @brief Animation - is the Animation which has finished with the animation.
+ *
+ */
+ public Animation Animation
+ {
+ get
+ {
+ return _animation;
+ }
+ set
+ {
+ _animation = value;
+ }
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FinishedEventHandler(object source, FinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FinishedEventCallbackDelegate(IntPtr Animation);
+ private FinishedEventHandler _animationFinishedEventHandler;
+ private FinishedEventCallbackDelegate _animationFinishedEventCallbackDelegate;
+
+ /**
+ * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of FinishedEventHandler) provided by the user.
+ * Finished signal is emitted when an Animation's animations have finished.
+ */
+ public event FinishedEventHandler Finished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_animationFinishedEventHandler == null)
+ {
+ _animationFinishedEventHandler += value;
+
+ _animationFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
+ this.FinishedSignal().Connect(_animationFinishedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_animationFinishedEventHandler != null)
+ {
+ this.FinishedSignal().Disconnect(_animationFinishedEventCallbackDelegate);
+ }
+
+ _animationFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Animation FinishedSignal
+ private void OnFinished(IntPtr data)
+ {
+ FinishedEventArgs e = new FinishedEventArgs();
+
+ // Populate all members of "e" (FinishedEventArgs) with real data
+ e.Animation = Animation.GetAnimationFromPtr(data);
+
+ if (_animationFinishedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _animationFinishedEventHandler(this, e);
+ }
+ }
+
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ %}
+
+ %enddef
+
+
+%define DALI_animation_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ Animation_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ Animation_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+ %enddef
+
+ namespace Dali
+{
+ DALI_animation_EVENTHANDLER_PARAM( Dali, Animation);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define APPLICATION_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+ %typemap(csimports) NameSpace::ClassName %{
+ using System;
+ using System.Runtime.InteropServices;
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationInit signal
+ *
+ */
+ public class AUIApplicationInitEventArgs : EventArgs
+ {
+ private Application _application;
+
+ /**
+ * @brief Application - is the application that is being initialized
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationTerminate signal
+ *
+ */
+ public class AUIApplicationTerminateEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being Terminated
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationPause signal
+ *
+ */
+ public class AUIApplicationPauseEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being Paused
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationResume signal
+ *
+ */
+ public class AUIApplicationResumeEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being Resumed
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationReset signal
+ *
+ */
+ public class AUIApplicationResetEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being Reset
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationResize signal
+ *
+ */
+ public class AUIApplicationResizeEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being Resized
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationLanguageChanged signal
+ *
+ */
+ public class AUIApplicationLanguageChangedEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being affected with Device's language change
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationRegionChanged signal
+ *
+ */
+ public class AUIApplicationRegionChangedEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being affected with Device's region change
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationBatteryLow signal
+ *
+ */
+ public class AUIApplicationBatteryLowEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being affected when the battery level of the device is low
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationMemoryLow signal
+ *
+ */
+ public class AUIApplicationMemoryLowEventArgs : EventArgs
+ {
+ private Application _application;
+ /**
+ * @brief Application - is the application that is being affected when the memory level of the device is low
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ }
+
+ /**
+ * @brief Event arguments that passed via AUIApplicationAppControl signal
+ *
+ */
+ public class AUIApplicationAppControlEventArgs : EventArgs
+ {
+ private Application _application;
+ private IntPtr _voidp;
+ /**
+ * @brief Application - is the application that is receiving the launch request from another application
+ *
+ */
+ public Application Application
+ {
+ get
+ {
+ return _application;
+ }
+ set
+ {
+ _application = value;
+ }
+ }
+ /**
+ * @brief VoidP - contains the information about why the application is launched
+ *
+ */
+ public IntPtr VoidP
+ {
+ get
+ {
+ return _voidp;
+ }
+ set
+ {
+ _voidp = value;
+ }
+ }
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationInitEventHandler(object source, AUIApplicationInitEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationTerminateEventHandler(object source, AUIApplicationTerminateEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationPauseEventHandler(object source, AUIApplicationPauseEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationResumeEventHandler(object source, AUIApplicationResumeEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationResetEventHandler(object source, AUIApplicationResetEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationResizeEventHandler(object source, AUIApplicationResizeEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationLanguageChangedEventHandler(object source, AUIApplicationLanguageChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationRegionChangedEventHandler(object source, AUIApplicationRegionChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationBatteryLowEventHandler(object source, AUIApplicationBatteryLowEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationMemoryLowEventHandler(object source, AUIApplicationMemoryLowEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void AUIApplicationAppControlEventHandler(object source, AUIApplicationAppControlEventArgs e);
+
+%}
+
+%enddef
+
+
+%define APPLICATION_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+ %typemap(cscode) NameSpace::ClassName %{
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationInitEventCallbackDelegate(IntPtr application);
+ private AUIApplicationInitEventHandler _applicationInitEventHandler;
+ private AUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate;
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationTerminateEventCallbackDelegate(IntPtr application);
+ private AUIApplicationTerminateEventHandler _applicationTerminateEventHandler;
+ private AUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate;
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationPauseEventCallbackDelegate(IntPtr application);
+ private AUIApplicationPauseEventHandler _applicationPauseEventHandler;
+ private AUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationResumeEventCallbackDelegate(IntPtr application);
+ private AUIApplicationResumeEventHandler _applicationResumeEventHandler;
+ private AUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationResetEventCallbackDelegate(IntPtr application);
+ private AUIApplicationResetEventHandler _applicationResetEventHandler;
+ private AUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationResizeEventCallbackDelegate(IntPtr application);
+ private AUIApplicationResizeEventHandler _applicationResizeEventHandler;
+ private AUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
+ private AUIApplicationLanguageChangedEventHandler _applicationLanguageChangedEventHandler;
+ private AUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate;
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
+ private AUIApplicationRegionChangedEventHandler _applicationRegionChangedEventHandler;
+ private AUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationBatteryLowEventCallbackDelegate(IntPtr application);
+ private AUIApplicationBatteryLowEventHandler _applicationBatteryLowEventHandler;
+ private AUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationMemoryLowEventCallbackDelegate(IntPtr application);
+ private AUIApplicationMemoryLowEventHandler _applicationMemoryLowEventHandler;
+ private AUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void AUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
+ private AUIApplicationAppControlEventHandler _applicationAppControlEventHandler;
+ private AUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate;
+
+ /**
+ * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationInitEventHandler) provided by the user.
+ * Initialized signal is emitted when application is initialised
+ */
+ public event AUIApplicationInitEventHandler Initialized
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationInitEventHandler == null)
+ {
+ _applicationInitEventHandler += value;
+
+ _applicationInitEventCallbackDelegate = new AUIApplicationInitEventCallbackDelegate(OnApplicationInit);
+ this.InitSignal().Connect(_applicationInitEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationInitEventHandler != null)
+ {
+ this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
+ }
+
+ _applicationInitEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application InitSignal
+ private void OnApplicationInit(IntPtr data)
+ {
+ AUIApplicationInitEventArgs e = new AUIApplicationInitEventArgs();
+
+ // Populate all members of "e" (AUIApplicationInitEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationInitEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationInitEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationTerminateEventHandler) provided by the user.
+ * Terminated signal is emitted when application is terminated
+ */
+ public event AUIApplicationTerminateEventHandler Terminated
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationTerminateEventHandler == null)
+ {
+ _applicationTerminateEventHandler += value;
+
+ _applicationTerminateEventCallbackDelegate = new AUIApplicationTerminateEventCallbackDelegate(OnAUIApplicationTerminate);
+ this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationTerminateEventHandler != null)
+ {
+ this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
+ }
+
+ _applicationTerminateEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application TerminateSignal
+ private void OnAUIApplicationTerminate(IntPtr data)
+ {
+ AUIApplicationTerminateEventArgs e = new AUIApplicationTerminateEventArgs();
+
+ // Populate all members of "e" (AUIApplicationTerminateEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationTerminateEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationTerminateEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationPauseEventHandler) provided by the user.
+ * Paused signal is emitted when application is paused
+ */
+ public event AUIApplicationPauseEventHandler Paused
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationPauseEventHandler == null)
+ {
+ _applicationPauseEventHandler += value;
+
+ _applicationPauseEventCallbackDelegate = new AUIApplicationPauseEventCallbackDelegate(OnAUIApplicationPause);
+ this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationPauseEventHandler != null)
+ {
+ this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
+ }
+
+ _applicationPauseEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application PauseSignal
+ private void OnAUIApplicationPause(IntPtr data)
+ {
+ AUIApplicationPauseEventArgs e = new AUIApplicationPauseEventArgs();
+
+ // Populate all members of "e" (AUIApplicationPauseEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationPauseEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationPauseEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationResumeEventHandler) provided by the user.
+ * Resumed signal is emitted when application is resumed
+ */
+ public event AUIApplicationResumeEventHandler Resumed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationResumeEventHandler == null)
+ {
+ _applicationResumeEventHandler += value;
+
+ _applicationResumeEventCallbackDelegate = new AUIApplicationResumeEventCallbackDelegate(OnAUIApplicationResume);
+ this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationResumeEventHandler != null)
+ {
+ this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
+ }
+
+ _applicationResumeEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application ResumeSignal
+ private void OnAUIApplicationResume(IntPtr data)
+ {
+ AUIApplicationResumeEventArgs e = new AUIApplicationResumeEventArgs();
+
+ // Populate all members of "e" (AUIApplicationResumeEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationResumeEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationResumeEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationResetEventHandler) provided by the user.
+ * Reset signal is emitted when application is reset
+ */
+ public event AUIApplicationResetEventHandler Reset
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationResetEventHandler == null)
+ {
+ _applicationResetEventHandler += value;
+
+ _applicationResetEventCallbackDelegate = new AUIApplicationResetEventCallbackDelegate(OnAUIApplicationReset);
+ this.ResetSignal().Connect(_applicationResetEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationResetEventHandler != null)
+ {
+ this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
+ }
+
+ _applicationResetEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application ResetSignal
+ private void OnAUIApplicationReset(IntPtr data)
+ {
+ AUIApplicationResetEventArgs e = new AUIApplicationResetEventArgs();
+
+ // Populate all members of "e" (AUIApplicationResetEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationResetEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationResetEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for Resized signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationResizeEventHandler) provided by the user.
+ * Resized signal is emitted when application is resized
+ */
+ public event AUIApplicationResizeEventHandler Resized
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationResizeEventHandler == null)
+ {
+ _applicationResizeEventHandler += value;
+
+ _applicationResizeEventCallbackDelegate = new AUIApplicationResizeEventCallbackDelegate(OnAUIApplicationResize);
+ this.ResizeSignal().Connect(_applicationResizeEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationResizeEventHandler != null)
+ {
+ this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate);
+ }
+
+ _applicationResizeEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application ResizeSignal
+ private void OnAUIApplicationResize(IntPtr data)
+ {
+ AUIApplicationResizeEventArgs e = new AUIApplicationResizeEventArgs();
+
+ // Populate all members of "e" (AUIApplicationResizeEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationResizeEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationResizeEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationLanguageChangedEventHandler) provided by the user.
+ * LanguageChanged signal is emitted when the region of the device is changed.
+ */
+ public event AUIApplicationLanguageChangedEventHandler LanguageChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationLanguageChangedEventHandler == null)
+ {
+ _applicationLanguageChangedEventHandler += value;
+
+ _applicationLanguageChangedEventCallbackDelegate = new AUIApplicationLanguageChangedEventCallbackDelegate(OnAUIApplicationLanguageChanged);
+ this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationLanguageChangedEventHandler != null)
+ {
+ this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
+ }
+
+ _applicationLanguageChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application LanguageChangedSignal
+ private void OnAUIApplicationLanguageChanged(IntPtr data)
+ {
+ AUIApplicationLanguageChangedEventArgs e = new AUIApplicationLanguageChangedEventArgs();
+
+ // Populate all members of "e" (AUIApplicationLanguageChangedEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationLanguageChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationLanguageChangedEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationRegionChangedEventHandler) provided by the user.
+ * RegionChanged signal is emitted when the region of the device is changed.
+ */
+ public event AUIApplicationRegionChangedEventHandler RegionChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationRegionChangedEventHandler == null)
+ {
+ _applicationRegionChangedEventHandler += value;
+
+ _applicationRegionChangedEventCallbackDelegate = new AUIApplicationRegionChangedEventCallbackDelegate(OnAUIApplicationRegionChanged);
+ this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationRegionChangedEventHandler != null)
+ {
+ this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
+ }
+
+ _applicationRegionChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application RegionChangedSignal
+ private void OnAUIApplicationRegionChanged(IntPtr data)
+ {
+ AUIApplicationRegionChangedEventArgs e = new AUIApplicationRegionChangedEventArgs();
+
+ // Populate all members of "e" (AUIApplicationRegionChangedEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationRegionChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationRegionChangedEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationBatteryLowEventHandler) provided by the user.
+ * BatteryLow signal is emitted when the battery level of the device is low.
+ */
+ public event AUIApplicationBatteryLowEventHandler BatteryLow
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationBatteryLowEventHandler == null)
+ {
+ _applicationBatteryLowEventHandler += value;
+
+ _applicationBatteryLowEventCallbackDelegate = new AUIApplicationBatteryLowEventCallbackDelegate(OnAUIApplicationBatteryLow);
+ this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationBatteryLowEventHandler != null)
+ {
+ this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
+ }
+
+ _applicationBatteryLowEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application BatteryLowSignal
+ private void OnAUIApplicationBatteryLow(IntPtr data)
+ {
+ AUIApplicationBatteryLowEventArgs e = new AUIApplicationBatteryLowEventArgs();
+
+ // Populate all members of "e" (AUIApplicationBatteryLowEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationBatteryLowEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationBatteryLowEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationMemoryLowEventHandler) provided by the user.
+ * MemoryLow signal is emitted when the memory level of the device is low.
+ */
+ public event AUIApplicationMemoryLowEventHandler MemoryLow
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationMemoryLowEventHandler == null)
+ {
+ _applicationMemoryLowEventHandler += value;
+
+ _applicationMemoryLowEventCallbackDelegate = new AUIApplicationMemoryLowEventCallbackDelegate(OnAUIApplicationMemoryLow);
+ this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationMemoryLowEventHandler != null)
+ {
+ this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
+ }
+
+ _applicationMemoryLowEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application MemoryLowSignal
+ private void OnAUIApplicationMemoryLow(IntPtr data)
+ {
+ AUIApplicationMemoryLowEventArgs e = new AUIApplicationMemoryLowEventArgs();
+
+ // Populate all members of "e" (AUIApplicationMemoryLowEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(data);
+
+ if (_applicationMemoryLowEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationMemoryLowEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of AUIApplicationAppControlEventHandler) provided by the user.
+ * AppControl signal is emitted when another application sends a launch request to the application.
+ */
+ public event AUIApplicationAppControlEventHandler AppControl
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_applicationAppControlEventHandler == null)
+ {
+ _applicationAppControlEventHandler += value;
+
+ _applicationAppControlEventCallbackDelegate = new AUIApplicationAppControlEventCallbackDelegate(OnAUIApplicationAppControl);
+ this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_applicationAppControlEventHandler != null)
+ {
+ this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
+ }
+
+ _applicationAppControlEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Application AppControlSignal
+ private void OnAUIApplicationAppControl(IntPtr application, IntPtr voidp)
+ {
+ AUIApplicationAppControlEventArgs e = new AUIApplicationAppControlEventArgs();
+
+ // Populate all members of "e" (AUIApplicationAppControlEventArgs) with real data
+ e.Application = Application.GetApplicationFromPtr(application);
+ e.VoidP = voidp;
+
+ if (_applicationAppControlEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _applicationAppControlEventHandler(this, e);
+ }
+ }
+
+ private static Application instance; // singleton
+
+ public delegate void InitDelegate();
+
+ public delegate void TerminateDelegate();
+
+ public delegate void PauseDelegate();
+
+ public delegate void ResumeDelegate();
+
+ public delegate void ResizeDelegate();
+
+ public delegate void AppControlDelegate();
+
+ public delegate void LanguageChangedDelegate();
+
+ public delegate void RegionChangedDelegate();
+
+ public delegate void BatteryLowDelegate();
+
+ public delegate void MemoryLowDelegate();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void InitDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void TerminateDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void PauseDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void ResumeDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void ResizeDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void AppControlDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void LanguageChangedDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void RegionChangedDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void BatteryLowDelegateInternal();
+
+ [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
+ internal delegate void MemoryLowDelegateInternal();
+
+ static void Initialize()
+ {
+ // instance.InitDelegate();
+ }
+
+ public static Application GetApplicationFromPtr(global::System.IntPtr cPtr) {
+ Application ret = new Application(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ internal void SetupDelegates() {
+ InitDelegateInternal initializeCallback = new InitDelegateInternal( Initialize );
+ System.Console.WriteLine( "InitSignal connection count");
+
+ this.InitSignal().Connect( initializeCallback );
+ //Console.WriteLine( "InitSignal connection count = " + app.InitSignal().GetConnectionCount() );
+ }
+
+ public static Application NewApplication() {
+ Application ret = New(1);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+
+ // we've got an application now connect the signals
+ ret.SetupDelegates();
+ // set the singleton
+
+ return ret;
+ }
+
+ %}
+ %enddef
+
+%define DALI_APPLICATION_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ APPLICATION_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ APPLICATION_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+ %enddef
+
+ namespace Dali
+{
+ DALI_APPLICATION_EVENTHANDLER_PARAM( Dali, Application);
+}
+
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define BUILDER_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+ using System;
+ using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+
+%define BUILDER_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+ %typemap(cscode) NameSpace::ClassName %{
+
+ public class QuitEventArgs : EventArgs
+ {
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void QuitEventHandler(object source, QuitEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void QuitEventCallbackDelegate();
+ private QuitEventHandler _builderQuitEventHandler;
+ private QuitEventCallbackDelegate _builderQuitEventCallbackDelegate;
+
+ public event QuitEventHandler Quit
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_builderQuitEventHandler == null)
+ {
+ _builderQuitEventHandler += value;
+
+ _builderQuitEventCallbackDelegate = new QuitEventCallbackDelegate(OnQuit);
+ this.QuitSignal().Connect(_builderQuitEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_builderQuitEventHandler != null)
+ {
+ this.QuitSignal().Disconnect(_builderQuitEventCallbackDelegate);
+ }
+
+ _builderQuitEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Builder QuitSignal
+ private void OnQuit()
+ {
+ QuitEventArgs e = new QuitEventArgs();
+
+ if (_builderQuitEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _builderQuitEventHandler(this, e);
+ }
+ }
+
+ %}
+ %enddef
+
+%define DALI_BUILDER_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ BUILDER_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ BUILDER_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+ %enddef
+
+ namespace Dali
+{
+ DALI_BUILDER_EVENTHANDLER_PARAM( Dali::Toolkit, Builder);
+}
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// Example from Swig MACRO
+
+%define EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class ClickedEventArgs : EventArgs
+{
+ private Button _button;
+
+ public Button Button
+ {
+ get
+ {
+ return _button;
+ }
+ set
+ {
+ _button = value;
+ }
+ }
+}
+
+public class PressedEventArgs : EventArgs
+{
+ private Button _button;
+
+ public Button Button
+ {
+ get
+ {
+ return _button;
+ }
+ set
+ {
+ _button = value;
+ }
+ }
+}
+
+public class ReleasedEventArgs : EventArgs
+{
+ private Button _button;
+
+ public Button Button
+ {
+ get
+ {
+ return _button;
+ }
+ set
+ {
+ _button = value;
+ }
+ }
+}
+
+public class StateChangedEventArgs : EventArgs
+{
+ private Button _button;
+
+ public Button Button
+ {
+ get
+ {
+ return _button;
+ }
+ set
+ {
+ _button = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ClickedEventHandler(object source, ClickedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool PressedEventHandler(object source, PressedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ReleasedEventHandler(object source, ReleasedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool StateChangedEventHandler(object source, StateChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ClickedCallbackDelegate(global::System.IntPtr data);
+ private ClickedEventHandler _buttonClickedEventHandler;
+ private ClickedCallbackDelegate _buttonClickedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool PressedCallbackDelegate(global::System.IntPtr data);
+ private PressedEventHandler _buttonPressedEventHandler;
+ private PressedCallbackDelegate _buttonPressedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ReleasedCallbackDelegate(global::System.IntPtr data);
+ private ReleasedEventHandler _buttonReleasedEventHandler;
+ private ReleasedCallbackDelegate _buttonReleasedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool StateChangedCallbackDelegate(global::System.IntPtr data);
+ private StateChangedEventHandler _buttonStateChangedEventHandler;
+ private StateChangedCallbackDelegate _buttonStateChangedCallbackDelegate;
+
+
+ public event ClickedEventHandler Clicked
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_buttonClickedEventHandler == null)
+ {
+ _buttonClickedEventHandler += value;
+
+ _buttonClickedCallbackDelegate = new ClickedCallbackDelegate(OnClicked);
+ this.ClickedSignal().Connect(_buttonClickedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_buttonClickedEventHandler != null)
+ {
+ this.ClickedSignal().Disconnect(_buttonClickedCallbackDelegate);
+ }
+
+ _buttonClickedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for button click signal
+ private bool OnClicked (IntPtr data)
+ {
+ Button##ClickedEventArgs e = new ClickedEventArgs();
+
+ e.Button = Button.GetButtonFromPtr(data);
+
+ if (_buttonClickedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _buttonClickedEventHandler(this, e);
+ }
+ return false;
+ }
+
+
+ public event PressedEventHandler Pressed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_buttonPressedEventHandler == null)
+ {
+ _buttonPressedEventHandler += value;
+
+ _buttonPressedCallbackDelegate = new PressedCallbackDelegate(OnPressed);
+ this.PressedSignal().Connect(_buttonPressedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_buttonPressedEventHandler != null)
+ {
+ this.PressedSignal().Disconnect(_buttonPressedCallbackDelegate);
+ }
+
+ _buttonPressedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for button click signal
+ private bool OnPressed (IntPtr data)
+ {
+ Button##PressedEventArgs e = new PressedEventArgs();
+
+ e.Button = Button.GetButtonFromPtr(data);
+
+ if (_buttonPressedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _buttonPressedEventHandler(this, e);
+ }
+ return false;
+ }
+
+
+ public event ReleasedEventHandler Released
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_buttonReleasedEventHandler == null)
+ {
+ _buttonReleasedEventHandler += value;
+
+ _buttonReleasedCallbackDelegate = new ReleasedCallbackDelegate(OnReleased);
+ this.ReleasedSignal().Connect(_buttonReleasedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_buttonReleasedEventHandler != null)
+ {
+ this.ReleasedSignal().Disconnect(_buttonReleasedCallbackDelegate);
+ }
+
+ _buttonReleasedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for button click signal
+ private bool OnReleased (IntPtr data)
+ {
+ Button##ReleasedEventArgs e = new ReleasedEventArgs();
+
+ e.Button = Button.GetButtonFromPtr(data);
+
+ if (_buttonReleasedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _buttonReleasedEventHandler(this, e);
+ }
+ return false;
+ }
+
+
+ public event StateChangedEventHandler StateChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_buttonStateChangedEventHandler == null)
+ {
+ _buttonStateChangedEventHandler += value;
+
+ _buttonStateChangedCallbackDelegate = new StateChangedCallbackDelegate(OnStateChanged);
+ this.StateChangedSignal().Connect(_buttonStateChangedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_buttonStateChangedEventHandler != null)
+ {
+ this.StateChangedSignal().Disconnect(_buttonStateChangedCallbackDelegate);
+ }
+
+ _buttonStateChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for button click signal
+ private bool OnStateChanged (IntPtr data)
+ {
+ Button##StateChangedEventArgs e = new StateChangedEventArgs();
+
+ e.Button = Button.GetButtonFromPtr(data);
+
+ if (_buttonStateChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _buttonStateChangedEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+%enddef
+
+
+%define BUTTON_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ BUTTON_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ BUTTON_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ BUTTON_EVENTHANDLER_PARAM( Dali::Toolkit, Button);
+
+} // namespace DALi
+
+
+
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define CONTROL_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define CONTROL_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+/**
+ * @brief Event arguments that passed via KeyInputFocusGained signal
+ *
+ */
+public class KeyInputFocusGainedEventArgs : EventArgs
+{
+ private Control _control;
+
+ /**
+ * @brief Control - is the control that gets Key Input Focus
+ *
+ */
+ public Control Control
+ {
+ get
+ {
+ return _control;
+ }
+ set
+ {
+ _control = value;
+ }
+ }
+}
+
+/**
+ * @brief Event arguments that passed via KeyInputFocusLost signal
+ *
+ */
+public class KeyInputFocusLostEventArgs : EventArgs
+{
+ private Control _control;
+
+ /**
+ * @brief Control - is the control that loses Key Input Focus
+ *
+ */
+ public Control Control
+ {
+ get
+ {
+ return _control;
+ }
+ set
+ {
+ _control = value;
+ }
+ }
+}
+
+/**
+ * @brief Event arguments that passed via KeyEvent signal
+ *
+ */
+public class KeyEventArgs : EventArgs
+{
+ private Control _control;
+ private KeyEvent _keyEvent;
+
+ /**
+ * @brief Control - is the control that recieves the keyevent.
+ *
+ */
+ public Control Control
+ {
+ get
+ {
+ return _control;
+ }
+ set
+ {
+ _control = value;
+ }
+ }
+
+ /**
+ * @brief KeyEvent - is the keyevent sent to the Control.
+ *
+ */
+ public KeyEvent KeyEvent
+ {
+ get
+ {
+ return _keyEvent;
+ }
+ set
+ {
+ _keyEvent = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void KeyInputFocusGainedEventHandler(object source, KeyInputFocusGainedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void KeyInputFocusLostEventHandler(object source, KeyInputFocusLostEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool KeyEventHandler(object source, KeyEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control);
+ private KeyInputFocusGainedEventHandler _KeyInputFocusGainedEventHandler;
+ private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control);
+ private KeyInputFocusLostEventHandler _KeyInputFocusLostEventHandler;
+ private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr keyEvent);
+ private KeyEventHandler _KeyEventHandler;
+ private KeyCallbackDelegate _KeyCallbackDelegate;
+
+ /**
+ * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyInputFocusGainedEventHandler) provided by the user.
+ * KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
+ */
+ public event KeyInputFocusGainedEventHandler KeyInputFocusGained
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyInputFocusGainedEventHandler == null)
+ {
+ _KeyInputFocusGainedEventHandler += value;
+
+ _KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained);
+ this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_KeyInputFocusGainedEventHandler != null)
+ {
+ this.KeyInputFocusGainedSignal().Disconnect(_KeyInputFocusGainedCallbackDelegate);
+ }
+
+ _KeyInputFocusGainedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnKeyInputFocusGained(IntPtr control)
+ {
+ KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs();
+
+ // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data
+ e.Control = Dali.Control.GetControlFromPtr(control);
+
+ if (_KeyInputFocusGainedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _KeyInputFocusGainedEventHandler(this, e);
+ }
+
+ }
+
+ /**
+ * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyInputFocusLostEventHandler) provided by the user.
+ * KeyInputFocusLost signal is emitted when the control loses Key Input Focus.
+ */
+ public event KeyInputFocusLostEventHandler KeyInputFocusLost
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyInputFocusLostEventHandler == null)
+ {
+ _KeyInputFocusLostEventHandler += value;
+
+ _KeyInputFocusLostCallbackDelegate = new KeyInputFocusLostCallbackDelegate(OnKeyInputFocusLost);
+ this.KeyInputFocusLostSignal().Connect(_KeyInputFocusLostCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_KeyInputFocusLostEventHandler != null)
+ {
+ this.KeyInputFocusLostSignal().Disconnect(_KeyInputFocusLostCallbackDelegate);
+ }
+
+ _KeyInputFocusLostEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnKeyInputFocusLost(IntPtr control)
+ {
+ KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs();
+
+ // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data
+ e.Control = Dali.Control.GetControlFromPtr(control);
+
+ if (_KeyInputFocusLostEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _KeyInputFocusLostEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyEventEventHandler) provided by the user.
+ * KeyPressed signal is emitted when key event is received.
+ */
+ public event KeyEventHandler KeyPressed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_KeyEventHandler == null)
+ {
+ _KeyEventHandler += value;
+
+ _KeyCallbackDelegate = new KeyCallbackDelegate(OnKeyEvent);
+ this.KeyEventSignal().Connect(_KeyCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_KeyEventHandler != null)
+ {
+ this.KeyEventSignal().Disconnect(_KeyCallbackDelegate);
+ }
+
+ _KeyEventHandler -= value;
+ }
+ }
+ }
+
+ private bool OnKeyEvent(IntPtr control, IntPtr keyEvent)
+ {
+ KeyEventArgs e = new KeyEventArgs();
+
+ // Populate all members of "e" (KeyEventArgs) with real data
+ e.Control = Dali.Control.GetControlFromPtr(control);
+ e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent);
+
+ if (_KeyEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _KeyEventHandler(this, e);
+ }
+ return false;
+
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_CONTROL_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ CONTROL_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ CONTROL_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_CONTROL_EVENTHANDLER_PARAM( Dali::Toolkit, Control);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define GAUSSIAN_BLURR_VIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define GAUSSIAN_BLURR_VIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+public class FinishedEventArgs : EventArgs
+{
+ private GaussianBlurView _gaussianBlurView;
+
+ public GaussianBlurView GaussianBlurView
+ {
+ get
+ {
+ return _gaussianBlurView;
+ }
+ set
+ {
+ _gaussianBlurView = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FinishedEventHandler(object source, FinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FinishedEventCallbackDelegate(IntPtr application);
+ private FinishedEventHandler _gaussianFinishedEventHandler;
+ private FinishedEventCallbackDelegate _gaussianFinishedEventCallbackDelegate;
+
+ public event FinishedEventHandler Finished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_gaussianFinishedEventHandler == null)
+ {
+ _gaussianFinishedEventHandler += value;
+
+ _gaussianFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished);
+ this.FinishedSignal().Connect(_gaussianFinishedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_gaussianFinishedEventHandler != null)
+ {
+ this.FinishedSignal().Disconnect(_gaussianFinishedEventCallbackDelegate);
+ }
+
+ _gaussianFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for GaussianBlurView FinishedSignal
+ private void OnFinished(IntPtr data)
+ {
+ FinishedEventArgs e = new FinishedEventArgs();
+
+ // Populate all members of "e" (FinishedEventArgs) with real data
+ e.GaussianBlurView = GaussianBlurView.GetGaussianBlurViewFromPtr(data);
+
+ if (_gaussianFinishedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _gaussianFinishedEventHandler(this, e);
+ }
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+%enddef
+
+%define DALI_GAUSSIAN_BLURR_VIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ GAUSSIAN_BLURR_VIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ GAUSSIAN_BLURR_VIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_GAUSSIAN_BLURR_VIEW_EVENTHANDLER_PARAM( Dali::Toolkit, GaussianBlurView);
+}
+
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define IMAGE_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define IMAGE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+/**
+ * @brief Event arguments that passed via Uploaded signal
+ *
+ */
+public class UploadedEventArgs : EventArgs
+{
+ private Image _image;
+ /**
+ * @brief Image - is the image data that gets uploaded to GL.
+ *
+ */
+ public Image Image
+ {
+ get
+ {
+ return _image;
+ }
+ set
+ {
+ _image = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void UploadedEventHandler(object source, UploadedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void UploadedEventCallbackDelegate(IntPtr image);
+ private UploadedEventHandler _imageUploadedEventHandler;
+ private UploadedEventCallbackDelegate _imageUploadedEventCallbackDelegate;
+
+ /**
+ * @brief Event for Uploaded signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of UploadedEventHandler) provided by the user.
+ * Uploaded signal is emitted when the image data gets uploaded to GL.
+ */
+ public event UploadedEventHandler Uploaded
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_imageUploadedEventHandler == null)
+ {
+ _imageUploadedEventHandler += value;
+
+ _imageUploadedEventCallbackDelegate = new UploadedEventCallbackDelegate(OnUploaded);
+ this.UploadedSignal().Connect(_imageUploadedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_imageUploadedEventHandler != null)
+ {
+ this.UploadedSignal().Disconnect(_imageUploadedEventCallbackDelegate);
+ }
+
+ _imageUploadedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Image UploadedSignal
+ private void OnUploaded(IntPtr data)
+ {
+ UploadedEventArgs e = new UploadedEventArgs();
+
+ // Populate all members of "e" (UploadedEventArgs) with real data
+ e.Image = Image.GetImageFromPtr(data);
+
+ if (_imageUploadedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _imageUploadedEventHandler(this, e);
+ }
+ }
+
+
+public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_IMAGE_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ IMAGE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ IMAGE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_IMAGE_EVENTHANDLER_PARAM( Dali, Image);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define ITEMVIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+
+%define ITEMVIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+ public class LayoutActivatedEventArgs : EventArgs
+ {
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void LayoutActivatedEventHandler(object source, LayoutActivatedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void LayoutActivatedEventCallbackDelegate();
+ private LayoutActivatedEventHandler _itemViewLayoutActivatedEventHandler;
+ private LayoutActivatedEventCallbackDelegate _itemViewLayoutActivatedEventCallbackDelegate;
+
+ public event LayoutActivatedEventHandler LayoutActivated
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_itemViewLayoutActivatedEventHandler == null)
+ {
+ _itemViewLayoutActivatedEventHandler += value;
+
+ _itemViewLayoutActivatedEventCallbackDelegate = new LayoutActivatedEventCallbackDelegate(OnLayoutActivated);
+ this.LayoutActivatedSignal().Connect(_itemViewLayoutActivatedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_itemViewLayoutActivatedEventHandler != null)
+ {
+ this.LayoutActivatedSignal().Disconnect(_itemViewLayoutActivatedEventCallbackDelegate);
+ }
+
+ _itemViewLayoutActivatedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ItemView LayoutActivatedSignal
+ private void OnLayoutActivated()
+ {
+ LayoutActivatedEventArgs e = new LayoutActivatedEventArgs();
+
+ if (_itemViewLayoutActivatedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _itemViewLayoutActivatedEventHandler(this, e);
+ }
+ }
+
+%}
+%enddef
+
+%define DALI_ITEMVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ ITEMVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ ITEMVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_ITEMVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, ItemView);
+}
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define KEYBOARD_FOCUS_MANAGER_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+%}
+
+%enddef
+
+
+%define KEYBOARD_FOCUS_MANAGER_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+/**
+ * @brief Event arguments that passed via FocusChanged signal
+ *
+ */
+public class FocusChangedEventArgs : EventArgs
+{
+ private Actor _actorCurrent;
+ private Actor _actorNext;
+
+ /**
+ * @brief Actor - is the original focused Actor
+ *
+ */
+ public Actor ActorCurrent
+ {
+ get
+ {
+ return _actorCurrent;
+ }
+ set
+ {
+ _actorCurrent = value;
+ }
+ }
+
+ /**
+ * @brief Actor - is the current focused Actor
+ *
+ */
+ public Actor ActorNext
+ {
+ get
+ {
+ return _actorNext;
+ }
+ set
+ {
+ _actorNext = value;
+ }
+ }
+}
+
+/**
+ * @brief Event arguments that passed via FocusGroupChanged signal
+ *
+ */
+public class FocusGroupChangedEventArgs : EventArgs
+{
+ private Actor _currentFocusedActor;
+ private bool _forwardDirection;
+
+ /**
+ * @brief Actor - is the current focused Actor
+ *
+ */
+ public Actor CurrentFocusedActor
+ {
+ get
+ {
+ return _currentFocusedActor;
+ }
+ set
+ {
+ _currentFocusedActor = value;
+ }
+ }
+
+ /**
+ * @brief ForwardDirection - is the direction (forward or backward) in which to move the focus next
+ *
+ */
+ public bool ForwardDirection
+ {
+ get
+ {
+ return _forwardDirection;
+ }
+ set
+ {
+ _forwardDirection = value;
+ }
+ }
+}
+
+/**
+ * @brief Event arguments that passed via FocusedActorEnterKey signal
+ *
+ */
+public class FocusedActorEnterKeyEventArgs : EventArgs
+{
+ private Actor _actor;
+
+ /**
+ * @brief Actor - is the current focused Actor which has the enter key pressed on it.
+ *
+ */
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FocusChangedEventHandler(object source, FocusChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FocusGroupChangedEventHandler(object source, FocusGroupChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FocusedActorEnterKeyEventHandler(object source, FocusedActorEnterKeyEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FocusChangedEventCallbackDelegate(IntPtr actorCurrent, IntPtr actorNext);
+ private FocusChangedEventHandler _keyboardFocusManagerFocusChangedEventHandler;
+ private FocusChangedEventCallbackDelegate _keyboardFocusManagerFocusChangedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FocusGroupChangedEventCallbackDelegate(IntPtr currentFocusedActor, bool forwardDirection);
+ private FocusGroupChangedEventHandler _keyboardFocusManagerFocusGroupChangedEventHandler;
+ private FocusGroupChangedEventCallbackDelegate _keyboardFocusManagerFocusGroupChangedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FocusedActorEnterKeyEventCallbackDelegate(IntPtr actor);
+ private FocusedActorEnterKeyEventHandler _keyboardFocusManagerFocusedActorEnterKeyEventHandler;
+ private FocusedActorEnterKeyEventCallbackDelegate _keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate;
+
+ /**
+ * @brief Event for FocusChanged signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of FocusChangedEventHandler) provided by the user.
+ * FocusChanged signal is emitted after the current focused actor has been changed.
+ */
+ public event FocusChangedEventHandler FocusChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_keyboardFocusManagerFocusChangedEventHandler == null)
+ {
+ _keyboardFocusManagerFocusChangedEventHandler += value;
+
+ _keyboardFocusManagerFocusChangedEventCallbackDelegate = new FocusChangedEventCallbackDelegate(OnFocusChanged);
+ this.FocusChangedSignal().Connect(_keyboardFocusManagerFocusChangedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_keyboardFocusManagerFocusChangedEventHandler != null)
+ {
+ this.FocusChangedSignal().Disconnect(_keyboardFocusManagerFocusChangedEventCallbackDelegate);
+ }
+
+ _keyboardFocusManagerFocusChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for KeyboardFocusManager FocusChangedSignal
+ private void OnFocusChanged(IntPtr actorCurrent, IntPtr actorNext)
+ {
+ FocusChangedEventArgs e = new FocusChangedEventArgs();
+
+ // Populate all members of "e" (FocusChangedEventArgs) with real data
+ e.ActorCurrent = Actor.GetActorFromPtr(actorCurrent);
+ e.ActorNext = Actor.GetActorFromPtr(actorNext);
+
+ if (_keyboardFocusManagerFocusChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _keyboardFocusManagerFocusChangedEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for FocusGroupChanged signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of FocusGroupChangedEventHandler) provided by the user.
+ * FocusGroupChanged signal is emitted when the focus group has been changed.
+ */
+ public event FocusGroupChangedEventHandler FocusGroupChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_keyboardFocusManagerFocusGroupChangedEventHandler == null)
+ {
+ _keyboardFocusManagerFocusGroupChangedEventHandler += value;
+
+ _keyboardFocusManagerFocusGroupChangedEventCallbackDelegate = new FocusGroupChangedEventCallbackDelegate(OnFocusGroupChanged);
+ this.FocusGroupChangedSignal().Connect(_keyboardFocusManagerFocusGroupChangedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_keyboardFocusManagerFocusGroupChangedEventHandler != null)
+ {
+ this.FocusGroupChangedSignal().Disconnect(_keyboardFocusManagerFocusGroupChangedEventCallbackDelegate);
+ }
+
+ _keyboardFocusManagerFocusGroupChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for KeyboardFocusManager FocusGroupChangedSignal
+ private void OnFocusGroupChanged(IntPtr currentFocusedActor, bool forwardDirection)
+ {
+ FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs();
+
+ // Populate all members of "e" (FocusGroupChangedEventArgs) with real data
+ e.CurrentFocusedActor = Actor.GetActorFromPtr(currentFocusedActor);
+ e.ForwardDirection = forwardDirection;
+
+ if (_keyboardFocusManagerFocusGroupChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _keyboardFocusManagerFocusGroupChangedEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for FocusedActorEnterKeyPressed signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of FocusedActorEnterKeyEventHandler) provided by the user.
+ * FocusedActorEnterKeyPressed signal is emitted when the current focused actor has the enter key pressed on it.
+ */
+ public event FocusedActorEnterKeyEventHandler FocusedActorEnterKeyPressed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler == null)
+ {
+ _keyboardFocusManagerFocusedActorEnterKeyEventHandler += value;
+
+ _keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate = new FocusedActorEnterKeyEventCallbackDelegate(OnFocusedActorEnterKey);
+ this.FocusedActorEnterKeySignal().Connect(_keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler != null)
+ {
+ this.FocusedActorEnterKeySignal().Disconnect(_keyboardFocusManagerFocusedActorEnterKeyEventCallbackDelegate);
+ }
+
+ _keyboardFocusManagerFocusedActorEnterKeyEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for KeyboardFocusManager FocusedActorEnterKeySignal
+ private void OnFocusedActorEnterKey(IntPtr actor)
+ {
+ FocusedActorEnterKeyEventArgs e = new FocusedActorEnterKeyEventArgs();
+
+ // Populate all members of "e" (FocusedActorEnterKeyEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+
+ if (_keyboardFocusManagerFocusedActorEnterKeyEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _keyboardFocusManagerFocusedActorEnterKeyEventHandler(this, e);
+ }
+ }
+
+%}
+%enddef
+
+%define DALI_KEYBOARD_FOCUS_MANAGER_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ KEYBOARD_FOCUS_MANAGER_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ KEYBOARD_FOCUS_MANAGER_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_KEYBOARD_FOCUS_MANAGER_EVENTHANDLER_PARAM( Dali::Toolkit, KeyboardFocusManager);
+}
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define LongPressGesture_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+%}
+%enddef
+
+%define LongPressGesture_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+public class DetectedEventArgs : EventArgs
+{
+ private Actor _actor;
+ private LongPressGesture _longPressGesture;
+
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+
+ public LongPressGesture LongPressGesture
+ {
+ get
+ {
+ return _longPressGesture;
+ }
+ set
+ {
+ _longPressGesture = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void DetectedEventHandler(object source, DetectedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr longPressGesture);
+ private DetectedEventHandler _longPressGestureEventHandler;
+ private DetectedCallbackDelegate _longPressGestureCallbackDelegate;
+
+
+ public event DetectedEventHandler Detected
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_longPressGestureEventHandler == null)
+ {
+ _longPressGestureEventHandler += value;
+
+ _longPressGestureCallbackDelegate = new DetectedCallbackDelegate(OnLongPressGestureDetected);
+ this.DetectedSignal().Connect(_longPressGestureCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_longPressGestureEventHandler != null)
+ {
+ this.DetectedSignal().Disconnect(_longPressGestureCallbackDelegate);
+ }
+
+ _longPressGestureEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnLongPressGestureDetected(IntPtr actor, IntPtr longPressGesture)
+ {
+ DetectedEventArgs e = new DetectedEventArgs();
+
+ // Populate all members of "e" (LongPressGestureEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+ e.LongPressGesture = Dali.LongPressGesture.GetLongPressGestureFromPtr(longPressGesture);
+
+ if (_longPressGestureEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _longPressGestureEventHandler(this, e);
+ }
+
+ }
+
+
+public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_longPressGesture_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ LongPressGesture_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ LongPressGesture_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_longPressGesture_EVENTHANDLER_PARAM( Dali, LongPressGestureDetector);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define OBJECT_REGISTRY_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+
+%define OBJECT_REGISTRY_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+public class ObjectCreatedEventArgs : EventArgs
+{
+ private BaseHandle _baseHandle;
+
+ public BaseHandle BaseHandle
+ {
+ get
+ {
+ return _baseHandle;
+ }
+ set
+ {
+ _baseHandle = value;
+ }
+ }
+}
+
+public class ObjectDestroyedEventArgs : EventArgs
+{
+ private RefObject _refObject;
+
+ public RefObject RefObject
+ {
+ get
+ {
+ return _refObject;
+ }
+ set
+ {
+ _refObject = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void ObjectCreatedEventHandler(object source, ObjectCreatedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void ObjectDestroyedEventHandler(object source, ObjectDestroyedEventArgs e);
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ObjectCreatedEventCallbackDelegate(IntPtr baseHandle);
+ private ObjectCreatedEventHandler _objectRegistryObjectCreatedEventHandler;
+ private ObjectCreatedEventCallbackDelegate _objectRegistryObjectCreatedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ObjectDestroyedEventCallbackDelegate(IntPtr fefObject);
+ private ObjectDestroyedEventHandler _objectRegistryObjectDestroyedEventHandler;
+ private ObjectDestroyedEventCallbackDelegate _objectRegistryObjectDestroyedEventCallbackDelegate;
+
+ public event ObjectCreatedEventHandler ObjectCreated
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_objectRegistryObjectCreatedEventHandler == null)
+ {
+ _objectRegistryObjectCreatedEventHandler += value;
+
+ _objectRegistryObjectCreatedEventCallbackDelegate = new ObjectCreatedEventCallbackDelegate(OnObjectCreated);
+ this.ObjectCreatedSignal().Connect(_objectRegistryObjectCreatedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_objectRegistryObjectCreatedEventHandler != null)
+ {
+ this.ObjectCreatedSignal().Disconnect(_objectRegistryObjectCreatedEventCallbackDelegate);
+ }
+
+ _objectRegistryObjectCreatedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ObjectRegistry ObjectCreatedSignal
+ private void OnObjectCreated(IntPtr baseHandle)
+ {
+ ObjectCreatedEventArgs e = new ObjectCreatedEventArgs();
+
+ // Populate all members of "e" (ObjectCreatedEventArgs) with real data
+ //e.BaseHandle = BaseHandle.GetBaseHandleFromPtr(baseHandle); //GetBaseHandleFromPtr() is not present in BaseHandle.cs. Not sure what is the reason?
+
+ if (_objectRegistryObjectCreatedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _objectRegistryObjectCreatedEventHandler(this, e);
+ }
+ }
+
+ public event ObjectDestroyedEventHandler ObjectDestroyed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_objectRegistryObjectDestroyedEventHandler == null)
+ {
+ _objectRegistryObjectDestroyedEventHandler += value;
+
+ _objectRegistryObjectDestroyedEventCallbackDelegate = new ObjectDestroyedEventCallbackDelegate(OnObjectDestroyed);
+ this.ObjectDestroyedSignal().Connect(_objectRegistryObjectDestroyedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_objectRegistryObjectDestroyedEventHandler != null)
+ {
+ this.ObjectDestroyedSignal().Disconnect(_objectRegistryObjectDestroyedEventCallbackDelegate);
+ }
+
+ _objectRegistryObjectDestroyedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ObjectRegistry ObjectDestroyedSignal
+ private void OnObjectDestroyed(IntPtr refObject)
+ {
+ ObjectDestroyedEventArgs e = new ObjectDestroyedEventArgs();
+
+ // Populate all members of "e" (ObjectDestroyedEventArgs) with real data
+ e.RefObject = RefObject.GetRefObjectFromPtr(refObject);
+
+ if (_objectRegistryObjectDestroyedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _objectRegistryObjectDestroyedEventHandler(this, e);
+ }
+ }
+
+%}
+%enddef
+
+%typemap(cscode) Dali::BaseHandle %{
+ public static BaseHandle GetBaseHandleFromPtr(global::System.IntPtr cPtr) {
+ BaseHandle ret = new BaseHandle(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+%}
+
+
+%define DALI_OBJECT_REGISTRY_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ OBJECT_REGISTRY_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ OBJECT_REGISTRY_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_OBJECT_REGISTRY_EVENTHANDLER_PARAM( Dali, ObjectRegistry);
+}
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define PAGETURNVIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define PAGETURNVIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class PagePanStartedEventArgs : EventArgs
+{
+ private PageTurnView _pageTurnView;
+
+ public PageTurnView PageTurnView
+ {
+ get
+ {
+ return _pageTurnView;
+ }
+ set
+ {
+ _pageTurnView = value;
+ }
+ }
+}
+
+public class PagePanFinishedEventArgs : EventArgs
+{
+ private PageTurnView _pageTurnView;
+
+ public PageTurnView PageTurnView
+ {
+ get
+ {
+ return _pageTurnView;
+ }
+ set
+ {
+ _pageTurnView = value;
+ }
+ }
+}
+
+public class PageTurnStartedEventArgs : EventArgs
+{
+ private PageTurnView _pageTurnView;
+ private uint _pageIndex;
+ private bool _isTurningForward;
+
+ public PageTurnView PageTurnView
+ {
+ get
+ {
+ return _pageTurnView;
+ }
+ set
+ {
+ _pageTurnView = value;
+ }
+ }
+
+ public uint PageIndex
+ {
+ get
+ {
+ return _pageIndex;
+ }
+ set
+ {
+ _pageIndex = value;
+ }
+ }
+
+ public bool IsTurningForward
+ {
+ get
+ {
+ return _isTurningForward;
+ }
+ set
+ {
+ _isTurningForward = value;
+ }
+ }
+
+}
+
+public class PageTurnFinishedEventArgs : EventArgs
+{
+ private PageTurnView _pageTurnView;
+ private uint _pageIndex;
+ private bool _isTurningForward;
+
+ public PageTurnView PageTurnView
+ {
+ get
+ {
+ return _pageTurnView;
+ }
+ set
+ {
+ _pageTurnView = value;
+ }
+ }
+
+ public uint PageIndex
+ {
+ get
+ {
+ return _pageIndex;
+ }
+ set
+ {
+ _pageIndex = value;
+ }
+ }
+
+ public bool IsTurningForward
+ {
+ get
+ {
+ return _isTurningForward;
+ }
+ set
+ {
+ _isTurningForward = value;
+ }
+ }
+
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void PagePanStartedEventHandler(object source, PagePanStartedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void PagePanFinishedEventHandler(object source, PagePanFinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void PageTurnStartedEventHandler(object source, PageTurnStartedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void PageTurnFinishedEventHandler(object source, PageTurnFinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void PagePanStartedCallbackDelegate(IntPtr page);
+ private PagePanStartedEventHandler _pageTurnViewPagePanStartedEventHandler;
+ private PagePanStartedCallbackDelegate _pageTurnViewPagePanStartedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void PagePanFinishedCallbackDelegate(IntPtr page);
+ private PagePanFinishedEventHandler _pageTurnViewPagePanFinishedEventHandler;
+ private PagePanFinishedCallbackDelegate _pageTurnViewPagePanFinishedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void PageTurnStartedCallbackDelegate(IntPtr page, uint pageIndex, bool isTurningForward);
+ private PageTurnStartedEventHandler _pageTurnViewPageTurnStartedEventHandler;
+ private PageTurnStartedCallbackDelegate _pageTurnViewPageTurnStartedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void PageTurnFinishedCallbackDelegate(IntPtr page, uint pageIndex, bool isTurningForward);
+ private PageTurnFinishedEventHandler _pageTurnViewPageTurnFinishedEventHandler;
+ private PageTurnFinishedCallbackDelegate _pageTurnViewPageTurnFinishedCallbackDelegate;
+
+ public event PagePanStartedEventHandler PagePanStarted
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_pageTurnViewPagePanStartedEventHandler == null)
+ {
+ _pageTurnViewPagePanStartedEventHandler += value;
+
+ _pageTurnViewPagePanStartedCallbackDelegate = new PagePanStartedCallbackDelegate(OnPagePanStarted);
+ this.PagePanStartedSignal().Connect(_pageTurnViewPagePanStartedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_pageTurnViewPagePanStartedEventHandler != null)
+ {
+ this.PagePanStartedSignal().Disconnect(_pageTurnViewPagePanStartedCallbackDelegate);
+ }
+
+ _pageTurnViewPagePanStartedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for PageTurnView PagePanStarted signal
+ private void OnPagePanStarted(IntPtr page)
+ {
+ PagePanStartedEventArgs e = new PagePanStartedEventArgs();
+
+ // Populate all members of "e" (PagePanStartedEventArgs) with real page
+ e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
+
+ if (_pageTurnViewPagePanStartedEventHandler != null)
+ {
+ //here we send all page to user event handlers
+ _pageTurnViewPagePanStartedEventHandler(this, e);
+ }
+ }
+
+ public event PagePanFinishedEventHandler PagePanFinished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_pageTurnViewPagePanFinishedEventHandler == null)
+ {
+ _pageTurnViewPagePanFinishedEventHandler += value;
+
+ _pageTurnViewPagePanFinishedCallbackDelegate = new PagePanFinishedCallbackDelegate(OnPagePanFinished);
+ this.PagePanFinishedSignal().Connect(_pageTurnViewPagePanFinishedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_pageTurnViewPagePanFinishedEventHandler != null)
+ {
+ this.PagePanFinishedSignal().Disconnect(_pageTurnViewPagePanFinishedCallbackDelegate);
+ }
+
+ _pageTurnViewPagePanFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for PageTurnView PagePanFinished signal
+ private void OnPagePanFinished(IntPtr page)
+ {
+ PagePanFinishedEventArgs e = new PagePanFinishedEventArgs();
+
+ // Populate all members of "e" (PagePanFinishedEventArgs) with real page
+ e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
+
+ if (_pageTurnViewPagePanFinishedEventHandler != null)
+ {
+ //here we send all page to user event handlers
+ _pageTurnViewPagePanFinishedEventHandler(this, e);
+ }
+ }
+
+
+ public event PageTurnStartedEventHandler PageTurnStarted
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_pageTurnViewPageTurnStartedEventHandler == null)
+ {
+ _pageTurnViewPageTurnStartedEventHandler += value;
+
+ _pageTurnViewPageTurnStartedCallbackDelegate = new PageTurnStartedCallbackDelegate(OnPageTurnStarted);
+ this.PageTurnStartedSignal().Connect(_pageTurnViewPageTurnStartedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_pageTurnViewPageTurnStartedEventHandler != null)
+ {
+ this.PageTurnStartedSignal().Disconnect(_pageTurnViewPageTurnStartedCallbackDelegate);
+ }
+
+ _pageTurnViewPageTurnStartedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for PageTurnView PageTurnStarted signal
+ private void OnPageTurnStarted(IntPtr page, uint pageIndex, bool isTurningForward)
+ {
+ PageTurnStartedEventArgs e = new PageTurnStartedEventArgs();
+
+ // Populate all members of "e" (PageTurnStartedEventArgs) with real page
+ e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
+ e.PageIndex = pageIndex;
+ e.IsTurningForward = isTurningForward;
+
+
+ if (_pageTurnViewPageTurnStartedEventHandler != null)
+ {
+ //here we send all page to user event handlers
+ _pageTurnViewPageTurnStartedEventHandler(this, e);
+ }
+ }
+
+
+ public event PageTurnFinishedEventHandler PageTurnFinished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_pageTurnViewPageTurnFinishedEventHandler == null)
+ {
+ _pageTurnViewPageTurnFinishedEventHandler += value;
+
+ _pageTurnViewPageTurnFinishedCallbackDelegate = new PageTurnFinishedCallbackDelegate(OnPageTurnFinished);
+ this.PageTurnFinishedSignal().Connect(_pageTurnViewPageTurnFinishedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_pageTurnViewPageTurnFinishedEventHandler != null)
+ {
+ this.PageTurnFinishedSignal().Disconnect(_pageTurnViewPageTurnFinishedCallbackDelegate);
+ }
+
+ _pageTurnViewPageTurnFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for PageTurnView PageTurnFinished signal
+ private void OnPageTurnFinished(IntPtr page, uint pageIndex, bool isTurningForward)
+ {
+ PageTurnFinishedEventArgs e = new PageTurnFinishedEventArgs();
+
+ // Populate all members of "e" (PageTurnFinishedEventArgs) with real page
+ e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr( page );
+ e.PageIndex = pageIndex;
+ e.IsTurningForward = isTurningForward;
+
+
+ if (_pageTurnViewPageTurnFinishedEventHandler != null)
+ {
+ //here we send all page to user event handlers
+ _pageTurnViewPageTurnFinishedEventHandler(this, e);
+ }
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_PAGETURNVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ PAGETURNVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ PAGETURNVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_PAGETURNVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, PageTurnView);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define PANGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define PANGESTURE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+public class DetectedEventArgs : EventArgs
+{
+ private Actor _actor;
+ private PanGesture _panGesture;
+
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+
+ public PanGesture PanGesture
+ {
+ get
+ {
+ return _panGesture;
+ }
+ set
+ {
+ _panGesture = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void DetectedEventHandler(object source, DetectedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr panGesture);
+ private DetectedEventHandler _panGestureEventHandler;
+ private DetectedCallbackDelegate _panGestureCallbackDelegate;
+
+
+ public event DetectedEventHandler Detected
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_panGestureEventHandler == null)
+ {
+ _panGestureEventHandler += value;
+
+ _panGestureCallbackDelegate = new DetectedCallbackDelegate(OnPanGestureDetected);
+ this.DetectedSignal().Connect(_panGestureCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_panGestureEventHandler != null)
+ {
+ this.DetectedSignal().Disconnect(_panGestureCallbackDelegate);
+ }
+
+ _panGestureEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnPanGestureDetected(IntPtr actor, IntPtr panGesture)
+ {
+ DetectedEventArgs e = new DetectedEventArgs();
+
+ // Populate all members of "e" (PanGestureEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+ e.PanGesture = Dali.PanGesture.GetPanGestureFromPtr(panGesture);
+
+ if (_panGestureEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _panGestureEventHandler(this, e);
+ }
+
+ }
+
+
+public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_PANGESTURE_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ PANGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ PANGESTURE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_PANGESTURE_EVENTHANDLER_PARAM( Dali, PanGestureDetector);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define PINCHGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define PINCHGESTURE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class DetectedEventArgs : EventArgs
+{
+ private Actor _actor;
+ private PinchGesture _pinchGesture;
+
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+
+ public PinchGesture PinchGesture
+ {
+ get
+ {
+ return _pinchGesture;
+ }
+ set
+ {
+ _pinchGesture = value;
+ }
+ }
+}
+
+[UnmanagedFunctionPointer(CallingConvention.StdCall)]
+public delegate void DetectedEventHandler(object source, DetectedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr pinchGesture);
+ private DetectedEventHandler _pinchGestureEventHandler;
+ private DetectedCallbackDelegate _pinchGestureCallbackDelegate;
+
+
+ public event DetectedEventHandler Detected
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_pinchGestureEventHandler == null)
+ {
+ _pinchGestureEventHandler += value;
+
+ _pinchGestureCallbackDelegate = new DetectedCallbackDelegate(OnPinchGestureDetected);
+ this.DetectedSignal().Connect(_pinchGestureCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_pinchGestureEventHandler != null)
+ {
+ this.DetectedSignal().Disconnect(_pinchGestureCallbackDelegate);
+ }
+
+ _pinchGestureEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnPinchGestureDetected(IntPtr actor, IntPtr pinchGesture)
+ {
+ DetectedEventArgs e = new DetectedEventArgs();
+
+ // Populate all members of "e" (DetectedEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+ e.PinchGesture = Dali.PinchGesture.GetPinchGestureFromPtr(pinchGesture);
+
+ if (_pinchGestureEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _pinchGestureEventHandler(this, e);
+ }
+
+ }
+
+
+public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_PINCHGESTURE_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ PINCHGESTURE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ PINCHGESTURE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_PINCHGESTURE_EVENTHANDLER_PARAM( Dali, PinchGestureDetector);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define POPUP_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+
+%define POPUP_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+ public class OutsideTouchedEventArgs : EventArgs
+ {
+ }
+
+ public class ShowingEventArgs : EventArgs
+ {
+ }
+
+ public class ShownEventArgs : EventArgs
+ {
+ }
+
+ public class HidingEventArgs : EventArgs
+ {
+ }
+
+ public class HiddenEventArgs : EventArgs
+ {
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void OutsideTouchedEventHandler(object source, OutsideTouchedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void ShowingEventHandler(object source, ShowingEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void ShownEventHandler(object source, ShownEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void HidingEventHandler(object source, HidingEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void HiddenEventHandler(object source, HiddenEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void OutsideTouchedEventCallbackDelegate();
+ private OutsideTouchedEventHandler _popUpOutsideTouchedEventHandler;
+ private OutsideTouchedEventCallbackDelegate _popUpOutsideTouchedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ShowingEventCallbackDelegate();
+ private ShowingEventHandler _popUpShowingEventHandler;
+ private ShowingEventCallbackDelegate _popUpShowingEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ShownEventCallbackDelegate();
+ private ShownEventHandler _popUpShownEventHandler;
+ private ShownEventCallbackDelegate _popUpShownEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void HidingEventCallbackDelegate();
+ private HidingEventHandler _popUpHidingEventHandler;
+ private HidingEventCallbackDelegate _popUpHidingEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void HiddenEventCallbackDelegate();
+ private HiddenEventHandler _popUpHiddenEventHandler;
+ private HiddenEventCallbackDelegate _popUpHiddenEventCallbackDelegate;
+
+ public event OutsideTouchedEventHandler OutsideTouched
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_popUpOutsideTouchedEventHandler == null)
+ {
+ _popUpOutsideTouchedEventHandler += value;
+
+ _popUpOutsideTouchedEventCallbackDelegate = new OutsideTouchedEventCallbackDelegate(OnOutsideTouched);
+ this.OutsideTouchedSignal().Connect(_popUpOutsideTouchedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_popUpOutsideTouchedEventHandler != null)
+ {
+ this.OutsideTouchedSignal().Disconnect(_popUpOutsideTouchedEventCallbackDelegate);
+ }
+
+ _popUpOutsideTouchedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Popup OutsideTouchedSignal
+ private void OnOutsideTouched()
+ {
+ OutsideTouchedEventArgs e = new OutsideTouchedEventArgs();
+
+ if (_popUpOutsideTouchedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _popUpOutsideTouchedEventHandler(this, e);
+ }
+ }
+
+ public event ShowingEventHandler Showing
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_popUpShowingEventHandler == null)
+ {
+ _popUpShowingEventHandler += value;
+
+ _popUpShowingEventCallbackDelegate = new ShowingEventCallbackDelegate(OnShowing);
+ this.ShowingSignal().Connect(_popUpShowingEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_popUpShowingEventHandler != null)
+ {
+ this.ShowingSignal().Disconnect(_popUpShowingEventCallbackDelegate);
+ }
+
+ _popUpShowingEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ShowingSignal
+ private void OnShowing()
+ {
+ ShowingEventArgs e = new ShowingEventArgs();
+
+ if (_popUpShowingEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _popUpShowingEventHandler(this, e);
+ }
+ }
+
+
+ public event ShownEventHandler Shown
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_popUpShownEventHandler == null)
+ {
+ _popUpShownEventHandler += value;
+
+ _popUpShownEventCallbackDelegate = new ShownEventCallbackDelegate(OnShown);
+ this.ShownSignal().Connect(_popUpShownEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_popUpShownEventHandler != null)
+ {
+ this.ShownSignal().Disconnect(_popUpShownEventCallbackDelegate);
+ }
+
+ _popUpShownEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ShownSignal
+ private void OnShown()
+ {
+ ShownEventArgs e = new ShownEventArgs();
+
+ if (_popUpShownEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _popUpShownEventHandler(this, e);
+ }
+ }
+
+ public event HidingEventHandler Hiding
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_popUpHidingEventHandler == null)
+ {
+ _popUpHidingEventHandler += value;
+
+ _popUpHidingEventCallbackDelegate = new HidingEventCallbackDelegate(OnHiding);
+ this.HidingSignal().Connect(_popUpHidingEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_popUpHidingEventHandler != null)
+ {
+ this.HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate);
+ }
+
+ _popUpHidingEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for HidingSignal
+ private void OnHiding()
+ {
+ HidingEventArgs e = new HidingEventArgs();
+
+ if (_popUpHidingEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _popUpHidingEventHandler(this, e);
+ }
+ }
+
+ public event HiddenEventHandler Hidden
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_popUpHiddenEventHandler == null)
+ {
+ _popUpHiddenEventHandler += value;
+
+ _popUpHiddenEventCallbackDelegate = new HiddenEventCallbackDelegate(OnHidden);
+ this.HiddenSignal().Connect(_popUpHiddenEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_popUpHiddenEventHandler != null)
+ {
+ this.HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate);
+ }
+
+ _popUpHiddenEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for HiddenSignal
+ private void OnHidden()
+ {
+ HiddenEventArgs e = new HiddenEventArgs();
+
+ if (_popUpHiddenEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _popUpHiddenEventHandler(this, e);
+ }
+ }
+%}
+%enddef
+
+%define DALI_POPUP_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ POPUP_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ POPUP_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_POPUP_EVENTHANDLER_PARAM( Dali::Toolkit, Popup);
+}
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+
+%define PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+/**
+ * @brief Event arguments that passed via Notify signal
+ *
+ */
+public class NotifyEventArgs : EventArgs
+{
+ private PropertyNotification _propertyNotification;
+
+ /**
+ * @brief PropertyNotification - is the PropertyNotification handle that has the notification properties.
+ *
+ */
+ public PropertyNotification PropertyNotification
+ {
+ get
+ {
+ return _propertyNotification;
+ }
+ set
+ {
+ _propertyNotification = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void NotifyEventHandler(object source, NotifyEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void NotifyEventCallbackDelegate(IntPtr propertyNotification);
+ private NotifyEventHandler _propertyNotificationNotifyEventHandler;
+ private NotifyEventCallbackDelegate _propertyNotificationNotifyEventCallbackDelegate;
+
+ /**
+ * @brief Event for Notified signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of NotifyEventHandler) provided by the user.
+ * Notified signal is emitted when the notification upon a condition of the property being met, has occurred.
+ */
+ public event NotifyEventHandler Notified
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_propertyNotificationNotifyEventHandler == null)
+ {
+ _propertyNotificationNotifyEventHandler += value;
+
+ _propertyNotificationNotifyEventCallbackDelegate = new NotifyEventCallbackDelegate(OnPropertyNotificationNotify);
+ this.NotifySignal().Connect(_propertyNotificationNotifyEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_propertyNotificationNotifyEventHandler != null)
+ {
+ this.NotifySignal().Disconnect(_propertyNotificationNotifyEventCallbackDelegate);
+ }
+
+ _propertyNotificationNotifyEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for PropertyNotification NotifySignal
+ private void OnPropertyNotificationNotify(IntPtr propertyNotification)
+ {
+ NotifyEventArgs e = new NotifyEventArgs();
+ e.PropertyNotification = GetPropertyNotificationFromPtr(propertyNotification);
+
+ if (_propertyNotificationNotifyEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _propertyNotificationNotifyEventHandler(this, e);
+ }
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+%enddef
+
+%define DALI_PROPERTYNOTIFICATION_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_PROPERTYNOTIFICATION_EVENTHANDLER_PARAM( Dali, PropertyNotification);
+}
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define RenderTask_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define RenderTask_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+public class FinishedEventArgs : EventArgs
+{
+ private RenderTask _renderTask;
+
+ public RenderTask RenderTask
+ {
+ get
+ {
+ return _renderTask;
+ }
+ set
+ {
+ _renderTask = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void RenderTaskEventHandler(object source, FinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void RenderTaskCallbackDelegate(IntPtr renderTask);
+ private RenderTaskEventHandler _renderTaskEventHandler;
+ private RenderTaskCallbackDelegate _renderTaskCallbackDelegate;
+
+
+ public event RenderTaskEventHandler Finished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_renderTaskEventHandler == null)
+ {
+ _renderTaskEventHandler += value;
+
+ _renderTaskCallbackDelegate = new RenderTaskCallbackDelegate(OnFinished);
+ this.FinishedSignal().Connect(_renderTaskCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_renderTaskEventHandler != null)
+ {
+ this.FinishedSignal().Disconnect(_renderTaskCallbackDelegate);
+ }
+
+ _renderTaskEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnFinished(IntPtr actor, IntPtr renderTask)
+ {
+ FinishedEventArgs e = new FinishedEventArgs();
+
+ // Populate all members of "e" (FinishedEventArgs) with real data
+ e.RenderTask = Dali.RenderTask.GetRenderTaskFromPtr(renderTask);
+
+ if (_renderTaskEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _renderTaskEventHandler(this, e);
+ }
+
+ }
+
+
+public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_renderTask_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ RenderTask_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ RenderTask_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_renderTask_EVENTHANDLER_PARAM( Dali, RenderTask);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define ResourceImage_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define ResourceImage_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class LoadingFinishedEventArgs : EventArgs
+{
+ private ResourceImage _resourceImage;
+
+ public ResourceImage ResourceImage
+ {
+ get
+ {
+ return _resourceImage;
+ }
+ set
+ {
+ _resourceImage = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void LoadingFinishedEventHandler(object source, LoadingFinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void LoadingFinishedEventCallbackDelegate(IntPtr ResourceImage);
+ private LoadingFinishedEventHandler _resourceImageLoadingFinishedEventHandler;
+ private LoadingFinishedEventCallbackDelegate _resourceImageLoadingFinishedEventCallbackDelegate;
+
+ public event LoadingFinishedEventHandler LoadingFinished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_resourceImageLoadingFinishedEventHandler == null)
+ {
+ _resourceImageLoadingFinishedEventHandler += value;
+
+ _resourceImageLoadingFinishedEventCallbackDelegate = new LoadingFinishedEventCallbackDelegate(OnLoadingFinished);
+ this.LoadingFinishedSignal().Connect(_resourceImageLoadingFinishedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_resourceImageLoadingFinishedEventHandler != null)
+ {
+ this.LoadingFinishedSignal().Disconnect(_resourceImageLoadingFinishedEventCallbackDelegate);
+ }
+
+ _resourceImageLoadingFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ResourceImage LoadingFinishedSignal
+ private void OnLoadingFinished(IntPtr data)
+ {
+ LoadingFinishedEventArgs e = new LoadingFinishedEventArgs();
+
+ // Populate all members of "e" (LoadingFinishedEventArgs) with real data
+ e.ResourceImage = ResourceImage.GetResourceImageFromPtr(data);
+
+ if (_resourceImageLoadingFinishedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _resourceImageLoadingFinishedEventHandler(this, e);
+ }
+ }
+
+
+public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_resourceImage_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ ResourceImage_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ ResourceImage_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_resourceImage_EVENTHANDLER_PARAM( Dali, ResourceImage);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define SCROLLABLE_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define SCROLLABLE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class StartedEventArgs : EventArgs
+{
+ private Vector2 _vector2;
+
+ public Vector2 Vector2
+ {
+ get
+ {
+ return _vector2;
+ }
+ set
+ {
+ _vector2 = value;
+ }
+ }
+}
+
+public class UpdatedEventArgs : EventArgs
+{
+ private Vector2 _vector2;
+
+ public Vector2 Vector2
+ {
+ get
+ {
+ return _vector2;
+ }
+ set
+ {
+ _vector2 = value;
+ }
+ }
+}
+
+public class CompletedEventArgs : EventArgs
+{
+ private Vector2 _vector2;
+
+ public Vector2 Vector2
+ {
+ get
+ {
+ return _vector2;
+ }
+ set
+ {
+ _vector2 = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void StartedEventHandler(object source, StartedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void UpdatedEventHandler(object source, UpdatedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void CompletedEventHandler(object source, CompletedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void StartedCallbackDelegate(IntPtr vector2);
+ private StartedEventHandler _scrollableStartedEventHandler;
+ private StartedCallbackDelegate _scrollableStartedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void UpdatedCallbackDelegate(IntPtr vector2);
+ private UpdatedEventHandler _scrollableUpdatedEventHandler;
+ private UpdatedCallbackDelegate _scrollableUpdatedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void CompletedCallbackDelegate(IntPtr vector2);
+ private CompletedEventHandler _scrollableCompletedEventHandler;
+ private CompletedCallbackDelegate _scrollableCompletedCallbackDelegate;
+
+ public event StartedEventHandler ScrollStarted
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_scrollableStartedEventHandler == null)
+ {
+ _scrollableStartedEventHandler += value;
+
+ _scrollableStartedCallbackDelegate = new StartedCallbackDelegate(OnStarted);
+ this.ScrollStartedSignal().Connect(_scrollableStartedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_scrollableStartedEventHandler != null)
+ {
+ this.ScrollStartedSignal().Disconnect(_scrollableStartedCallbackDelegate);
+ }
+
+ _scrollableStartedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnStarted(IntPtr vector2)
+ {
+ StartedEventArgs e = new StartedEventArgs();
+
+ // Populate all members of "e" (StartedEventArgs) with real data
+ e.Vector2 = Dali.Vector2.GetVector2FromPtr(vector2);
+
+ if (_scrollableStartedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _scrollableStartedEventHandler(this, e);
+ }
+
+ }
+
+ public event UpdatedEventHandler ScrollUpdated
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_scrollableUpdatedEventHandler == null)
+ {
+ _scrollableUpdatedEventHandler += value;
+
+ _scrollableUpdatedCallbackDelegate = new UpdatedCallbackDelegate(OnUpdated);
+ this.ScrollUpdatedSignal().Connect(_scrollableUpdatedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_scrollableUpdatedEventHandler != null)
+ {
+ this.ScrollUpdatedSignal().Disconnect(_scrollableUpdatedCallbackDelegate);
+ }
+
+ _scrollableUpdatedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnUpdated(IntPtr vector2)
+ {
+ UpdatedEventArgs e = new UpdatedEventArgs();
+
+ // Populate all members of "e" (UpdatedEventArgs) with real data
+ e.Vector2 = Dali.Vector2.GetVector2FromPtr(vector2);
+
+ if (_scrollableUpdatedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _scrollableUpdatedEventHandler(this, e);
+ }
+
+ }
+
+ public event CompletedEventHandler ScrollCompleted
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_scrollableCompletedEventHandler == null)
+ {
+ _scrollableCompletedEventHandler += value;
+
+ _scrollableCompletedCallbackDelegate = new CompletedCallbackDelegate(OnCompleted);
+ this.ScrollCompletedSignal().Connect(_scrollableCompletedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_scrollableCompletedEventHandler != null)
+ {
+ this.ScrollCompletedSignal().Disconnect(_scrollableCompletedCallbackDelegate);
+ }
+
+ _scrollableCompletedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnCompleted(IntPtr vector2)
+ {
+ CompletedEventArgs e = new CompletedEventArgs();
+
+ // Populate all members of "e" (CompletedEventArgs) with real data
+ e.Vector2 = Dali.Vector2.GetVector2FromPtr(vector2);
+
+ if (_scrollableCompletedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _scrollableCompletedEventHandler(this, e);
+ }
+
+ }
+
+%}
+
+%enddef
+
+%define DALI_SCROLLABLE_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ SCROLLABLE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ SCROLLABLE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_SCROLLABLE_EVENTHANDLER_PARAM( Dali::Toolkit, Scrollable);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define SCROLLBAR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+
+%define SCROLLBAR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+public class PanFinishedEventArgs : EventArgs
+{
+}
+
+public class ScrollPositionIntervalReachedEventArgs : EventArgs
+{
+ private float _currentScrollPosition;
+
+ public float CurrentScrollPosition
+ {
+ get
+ {
+ return _currentScrollPosition;
+ }
+ set
+ {
+ _currentScrollPosition = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void PanFinishedEventHandler(object source, PanFinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void ScrollPositionIntervalReachedEventHandler(object source, ScrollPositionIntervalReachedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void PanFinishedEventCallbackDelegate();
+ private PanFinishedEventHandler _scrollBarPanFinishedEventHandler;
+ private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ScrollPositionIntervalReachedEventCallbackDelegate();
+ private ScrollPositionIntervalReachedEventHandler _scrollBarScrollPositionIntervalReachedEventHandler;
+ private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate;
+
+ public event PanFinishedEventHandler PanFinished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_scrollBarPanFinishedEventHandler == null)
+ {
+ _scrollBarPanFinishedEventHandler += value;
+
+ _scrollBarPanFinishedEventCallbackDelegate = new PanFinishedEventCallbackDelegate(OnScrollBarPanFinished);
+ this.PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_scrollBarPanFinishedEventHandler != null)
+ {
+ this.PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate);
+ }
+
+ _scrollBarPanFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ScrollBar PanFinishedSignal
+ private void OnScrollBarPanFinished()
+ {
+ PanFinishedEventArgs e = new PanFinishedEventArgs();
+
+ if (_scrollBarPanFinishedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _scrollBarPanFinishedEventHandler(this, e);
+ }
+ }
+
+
+ public event ScrollPositionIntervalReachedEventHandler ScrollPositionIntervalReached
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_scrollBarScrollPositionIntervalReachedEventHandler == null)
+ {
+ _scrollBarScrollPositionIntervalReachedEventHandler += value;
+
+ _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = new ScrollPositionIntervalReachedEventCallbackDelegate(OnScrollBarScrollPositionIntervalReached);
+ this.ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
+ {
+ this.ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate);
+ }
+
+ _scrollBarScrollPositionIntervalReachedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ScrollBar ScrollPositionIntervalReachedSignal
+ private void OnScrollBarScrollPositionIntervalReached()
+ {
+ ScrollPositionIntervalReachedEventArgs e = new ScrollPositionIntervalReachedEventArgs();
+
+ if (_scrollBarScrollPositionIntervalReachedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _scrollBarScrollPositionIntervalReachedEventHandler(this, e);
+ }
+ }
+
+%}
+%enddef
+
+%define DALI_SCROLLBAR_EVENTHANDLER_PARAM( NameSpace, ClassName)
+ SCROLLBAR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ SCROLLBAR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+%enddef
+
+namespace Dali
+{
+ DALI_SCROLLBAR_EVENTHANDLER_PARAM( Dali::Toolkit, ScrollBar);
+}
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define SCROLLVIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define SCROLLVIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+/**
+ * @brief Event arguments that passed via SnapStarted signal
+ *
+ */
+public class SnapStartedEventArgs : EventArgs
+{
+ private Dali.ScrollView.SnapEvent _snapEvent;
+
+ /**
+ * @brief SnapEvent - is the SnapEvent information like snap or flick (it tells the target position, scale, rotation for the snap or flick).
+ *
+ */
+ public Dali.ScrollView.SnapEvent SnapEventInfo
+ {
+ get
+ {
+ return _snapEvent;
+ }
+ set
+ {
+ _snapEvent = value;
+ }
+ }
+}
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void SnapStartedEventHandler(object source, SnapStartedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void SnapStartedCallbackDelegate(IntPtr data);
+ private SnapStartedEventHandler _scrollViewSnapStartedEventHandler;
+ private SnapStartedCallbackDelegate _scrollViewSnapStartedCallbackDelegate;
+
+ /**
+ * @brief Event for SnapStarted signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of SnapStartedEventHandler) provided by the user.
+ * SnapStarted signal is emitted hen the ScrollView has started to snap or flick (it tells the target
+ * position, scale, rotation for the snap or flick).
+ *
+ */
+ public event SnapStartedEventHandler SnapStarted
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_scrollViewSnapStartedEventHandler == null)
+ {
+ _scrollViewSnapStartedEventHandler += value;
+
+ _scrollViewSnapStartedCallbackDelegate = new SnapStartedCallbackDelegate(OnSnapStarted);
+ this.SnapStartedSignal().Connect(_scrollViewSnapStartedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_scrollViewSnapStartedEventHandler != null)
+ {
+ this.SnapStartedSignal().Disconnect(_scrollViewSnapStartedCallbackDelegate);
+ }
+
+ _scrollViewSnapStartedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for ScrollView SnapStarted signal
+ private void OnSnapStarted(IntPtr data)
+ {
+ SnapStartedEventArgs e = new SnapStartedEventArgs();
+
+ // Populate all members of "e" (SnapStartedEventArgs) with real data
+ e.SnapEventInfo = SnapEvent.GetSnapEventFromPtr( data );
+
+ if (_scrollViewSnapStartedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _scrollViewSnapStartedEventHandler(this, e);
+ }
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_SCROLLVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ SCROLLVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ SCROLLVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_SCROLLVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, ScrollView);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define SLIDER_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define SLIDER_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class ValueChangedEventArgs : EventArgs
+{
+ private Slider _slider;
+ private float _slideValue;
+
+ public Slider Slider
+ {
+ get
+ {
+ return _slider;
+ }
+ set
+ {
+ _slider = value;
+ }
+ }
+
+ public float SlideValue
+ {
+ get
+ {
+ return _slideValue;
+ }
+ set
+ {
+ _slideValue = value;
+ }
+ }
+}
+
+public class SlidingFinishedEventArgs : EventArgs
+{
+ private Slider _slider;
+ private float _slideValue;
+
+ public Slider Slider
+ {
+ get
+ {
+ return _slider;
+ }
+ set
+ {
+ _slider = value;
+ }
+ }
+
+ public float SlideValue
+ {
+ get
+ {
+ return _slideValue;
+ }
+ set
+ {
+ _slideValue = value;
+ }
+ }
+}
+
+public class MarkReachedEventArgs : EventArgs
+{
+ private Slider _slider;
+ private int _slideValue;
+
+ public Slider Slider
+ {
+ get
+ {
+ return _slider;
+ }
+ set
+ {
+ _slider = value;
+ }
+ }
+
+ public int SlideValue
+ {
+ get
+ {
+ return _slideValue;
+ }
+ set
+ {
+ _slideValue = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool ValueChangedEventHandler(object source, ValueChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool SlidingFinishedEventHandler(object source, SlidingFinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool MarkReachedEventHandler(object source, MarkReachedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool ValueChangedCallbackDelegate(IntPtr slider, float slideValue);
+ private ValueChangedEventHandler _sliderValueChangedEventHandler;
+ private ValueChangedCallbackDelegate _sliderValueChangedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool SlidingFinishedCallbackDelegate(IntPtr slider, float slideValue);
+ private SlidingFinishedEventHandler _sliderSlidingFinishedEventHandler;
+ private SlidingFinishedCallbackDelegate _sliderSlidingFinishedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool MarkReachedCallbackDelegate(IntPtr slider, int slideValue);
+ private MarkReachedEventHandler _sliderMarkReachedEventHandler;
+ private MarkReachedCallbackDelegate _sliderMarkReachedCallbackDelegate;
+
+ public event ValueChangedEventHandler ValueChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_sliderValueChangedEventHandler == null)
+ {
+ _sliderValueChangedEventHandler += value;
+
+ _sliderValueChangedCallbackDelegate = new ValueChangedCallbackDelegate(OnValueChanged);
+ this.ValueChangedSignal().Connect(_sliderValueChangedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_sliderValueChangedEventHandler != null)
+ {
+ this.ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate);
+ }
+
+ _sliderValueChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Slider ValueChanged signal
+ private bool OnValueChanged(IntPtr slider, float slideValue)
+ {
+ ValueChangedEventArgs e = new ValueChangedEventArgs();
+
+ // Populate all members of "e" (ValueChangedEventArgs) with real page
+ e.Slider = Slider.GetSliderFromPtr( slider );
+ e.SlideValue = slideValue;
+
+ if (_sliderValueChangedEventHandler != null)
+ {
+ //here we send all page to user event handlers
+ return _sliderValueChangedEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event SlidingFinishedEventHandler SlidingFinished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_sliderSlidingFinishedEventHandler == null)
+ {
+ _sliderSlidingFinishedEventHandler += value;
+
+ _sliderSlidingFinishedCallbackDelegate = new SlidingFinishedCallbackDelegate(OnSlidingFinished);
+ this.SlidingFinishedSignal().Connect(_sliderSlidingFinishedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_sliderSlidingFinishedEventHandler != null)
+ {
+ this.SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate);
+ }
+
+ _sliderSlidingFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Slider SlidingFinished signal
+ private bool OnSlidingFinished(IntPtr slider, float slideValue)
+ {
+ SlidingFinishedEventArgs e = new SlidingFinishedEventArgs();
+
+ // Populate all members of "e" (SlidingFinishedEventArgs) with real page
+ e.Slider = Slider.GetSliderFromPtr( slider );
+ e.SlideValue = slideValue;
+
+ if (_sliderSlidingFinishedEventHandler != null)
+ {
+ //here we send all page to user event handlers
+ return _sliderSlidingFinishedEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public event MarkReachedEventHandler MarkReached
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_sliderMarkReachedEventHandler == null)
+ {
+ _sliderMarkReachedEventHandler += value;
+
+ _sliderMarkReachedCallbackDelegate = new MarkReachedCallbackDelegate(OnMarkReached);
+ this.MarkReachedSignal().Connect(_sliderMarkReachedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_sliderMarkReachedEventHandler != null)
+ {
+ this.MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate);
+ }
+
+ _sliderMarkReachedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Slider MarkReached signal
+ private bool OnMarkReached(IntPtr slider, int slideValue)
+ {
+ MarkReachedEventArgs e = new MarkReachedEventArgs();
+
+ // Populate all members of "e" (MarkReachedEventArgs) with real page
+ e.Slider = Slider.GetSliderFromPtr( slider );
+ e.SlideValue = slideValue;
+
+ if (_sliderMarkReachedEventHandler != null)
+ {
+ //here we send all page to user event handlers
+ return _sliderMarkReachedEventHandler(this, e);
+ }
+ return false;
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_SLIDER_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ SLIDER_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ SLIDER_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_SLIDER_EVENTHANDLER_PARAM( Dali::Toolkit, Slider);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define STAGE_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define STAGE_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+/**
+ * @brief Event arguments that passed via Touch signal
+ *
+ */
+public class TouchEventArgs : EventArgs
+{
+ private TouchData _touchData;
+
+ /**
+ * @brief TouchData - contains the information of touch points
+ *
+ */
+ public TouchData TouchData
+ {
+ get
+ {
+ return _touchData;
+ }
+ set
+ {
+ _touchData = value;
+ }
+ }
+}
+
+
+/**
+ * @brief Event arguments that passed via Wheel signal
+ *
+ */
+public class WheelEventArgs : EventArgs
+{
+ private WheelEvent _wheelEvent;
+
+ /**
+ * @brief WheelEvent - store a wheel rolling type MOUSE_WHEEL or CUSTOM_WHEEL
+ *
+ */
+ public WheelEvent WheelEvent
+ {
+ get
+ {
+ return _wheelEvent;
+ }
+ set
+ {
+ _wheelEvent = value;
+ }
+ }
+}
+
+/**
+ * @brief Event arguments that passed via KeyEvent signal
+ *
+ */
+public class KeyEventArgs : EventArgs
+{
+ private KeyEvent _keyEvent;
+
+ /**
+ * @brief KeyEvent - is the keyevent sent to Stage.
+ *
+ */
+ public KeyEvent KeyEvent
+ {
+ get
+ {
+ return _keyEvent;
+ }
+ set
+ {
+ _keyEvent = value;
+ }
+ }
+}
+
+/**
+ * @brief Event arguments that passed via EventProcessingFinished signal
+ *
+ */
+public class EventProcessingFinishedEventArgs : EventArgs
+{
+}
+
+/**
+ * @brief Event arguments that passed via ContextLost signal
+ *
+ */
+public class ContextLostEventArgs : EventArgs
+{
+}
+
+/**
+ * @brief Event arguments that passed via ContextRegained signal
+ *
+ */
+public class ContextRegainedEventArgs : EventArgs
+{
+}
+
+/**
+ * @brief Event arguments that passed via SceneCreated signal
+ *
+ */
+public class SceneCreatedEventArgs : EventArgs
+{
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void TouchEventHandler(object source, TouchEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void WheelEventHandler(object source, WheelEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void KeyEventHandler(object source, KeyEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void EventProcessingFinishedEventHandler(object source, EventProcessingFinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void ContextLostEventHandler(object source, ContextLostEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void ContextRegainedEventHandler(object source, ContextRegainedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void SceneCreatedEventHandler(object source, SceneCreatedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void StageTouchCallbackDelegate(IntPtr data);
+ private TouchEventHandler _stageTouchEventHandler;
+ private StageTouchCallbackDelegate _stageTouchCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void WheelCallbackDelegate(IntPtr data);
+ private WheelEventHandler _stageWheelEventHandler;
+ private WheelCallbackDelegate _stageWheelCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void KeyCallbackDelegate(IntPtr data);
+ private KeyEventHandler _stageKeyEventHandler;
+ private KeyCallbackDelegate _stageKeyCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void EventProcessingFinishedEventCallbackDelegate();
+ private EventProcessingFinishedEventHandler _stageEventProcessingFinishedEventHandler;
+ private EventProcessingFinishedEventCallbackDelegate _stageEventProcessingFinishedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ContextLostEventCallbackDelegate();
+ private ContextLostEventHandler _stageContextLostEventHandler;
+ private ContextLostEventCallbackDelegate _stageContextLostEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void ContextRegainedEventCallbackDelegate();
+ private ContextRegainedEventHandler _stageContextRegainedEventHandler;
+ private ContextRegainedEventCallbackDelegate _stageContextRegainedEventCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void SceneCreatedEventCallbackDelegate();
+ private SceneCreatedEventHandler _stageSceneCreatedEventHandler;
+ private SceneCreatedEventCallbackDelegate _stageSceneCreatedEventCallbackDelegate;
+
+ /**
+ * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of TouchEventHandler) provided by the user.
+ * Touched signal is emitted when the screen is touched and when the touch ends
+ * (i.e. the down & up touch events only).
+ *
+ */
+ public event TouchEventHandler Touched
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_stageTouchEventHandler == null)
+ {
+ _stageTouchEventHandler += value;
+
+ _stageTouchCallbackDelegate = new StageTouchCallbackDelegate(OnStageTouch);
+ this.TouchSignal().Connect(_stageTouchCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_stageTouchEventHandler != null)
+ {
+ this.TouchSignal().Disconnect(_stageTouchCallbackDelegate);
+ }
+
+ _stageTouchEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Stage Touch signal
+ private void OnStageTouch(IntPtr data)
+ {
+ TouchEventArgs e = new TouchEventArgs();
+
+ // Populate all members of "e" (TouchEventArgs) with real data
+ e.TouchData = TouchData.GetTouchDataFromPtr( data );
+
+ if (_stageTouchEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageTouchEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of WheelEventHandler) provided by the user.
+ * WheelMoved signal is emitted is emitted when wheel event is received.
+ *
+ */
+ public event WheelEventHandler WheelMoved
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_stageWheelEventHandler == null)
+ {
+ _stageWheelEventHandler += value;
+
+ _stageWheelCallbackDelegate = new WheelCallbackDelegate(OnStageWheel);
+ this.WheelEventSignal().Connect(_stageWheelCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_stageWheelEventHandler != null)
+ {
+ this.WheelEventSignal().Disconnect(_stageWheelCallbackDelegate);
+ }
+
+ _stageWheelEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Stage WheelEventsignal
+ private void OnStageWheel(IntPtr data)
+ {
+ WheelEventArgs e = new WheelEventArgs();
+
+ // Populate all members of "e" (WheelEventArgs) with real data
+ e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr( data );
+
+ if (_stageWheelEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageWheelEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of KeyEventHandler) provided by the user.
+ * KeyPressed signal is emitted is emitted when key event is received.
+ *
+ */
+ public event KeyEventHandler KeyPressed
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_stageKeyEventHandler == null)
+ {
+ _stageKeyEventHandler += value;
+
+ _stageKeyCallbackDelegate = new KeyCallbackDelegate(OnStageKey);
+ this.KeyEventSignal().Connect(_stageKeyCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_stageKeyEventHandler != null)
+ {
+ this.KeyEventSignal().Disconnect(_stageKeyCallbackDelegate);
+ }
+
+ _stageKeyEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Stage KeyEventsignal
+ private void OnStageKey(IntPtr keyEvent)
+ {
+ KeyEventArgs e = new KeyEventArgs();
+
+ // Populate all members of "e" (KeyEventArgs) with real data
+ e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr( keyEvent );
+
+ if (_stageKeyEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageKeyEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for EventProcessingFinished signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of EventProcessingFinishedEventHandler) provided by the user.
+ * EventProcessingFinished signal is emitted just after the event processing is finished.
+ *
+ */
+ public event EventProcessingFinishedEventHandler EventProcessingFinished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_stageEventProcessingFinishedEventHandler == null)
+ {
+ _stageEventProcessingFinishedEventHandler += value;
+
+ _stageEventProcessingFinishedEventCallbackDelegate = new EventProcessingFinishedEventCallbackDelegate(OnEventProcessingFinished);
+ this.EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_stageEventProcessingFinishedEventHandler != null)
+ {
+ this.EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate);
+ }
+
+ _stageEventProcessingFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Stage EventProcessingFinishedSignal
+ private void OnEventProcessingFinished()
+ {
+ EventProcessingFinishedEventArgs e = new EventProcessingFinishedEventArgs();
+
+ if (_stageEventProcessingFinishedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageEventProcessingFinishedEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for ContextLost signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of ContextLostEventHandler) provided by the user.
+ * ContextLost signal is emitted when the GL context is lost (Platform specific behaviour).
+ *
+ */
+ public event ContextLostEventHandler ContextLost
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_stageContextLostEventHandler == null)
+ {
+ _stageContextLostEventHandler += value;
+
+ _stageContextLostEventCallbackDelegate = new ContextLostEventCallbackDelegate(OnContextLost);
+ this.ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_stageContextLostEventHandler != null)
+ {
+ this.ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate);
+ }
+
+ _stageContextLostEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Stage ContextLostSignal
+ private void OnContextLost()
+ {
+ ContextLostEventArgs e = new ContextLostEventArgs();
+
+ if (_stageContextLostEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageContextLostEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for ContextRegained signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of ContextRegainedEventHandler) provided by the user.
+ * ContextRegained signal is emitted when the GL context is regained (Platform specific
+ * behaviour).
+ *
+ */
+ public event ContextRegainedEventHandler ContextRegained
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_stageContextRegainedEventHandler == null)
+ {
+ _stageContextRegainedEventHandler += value;
+
+ _stageContextRegainedEventCallbackDelegate = new ContextRegainedEventCallbackDelegate(OnContextRegained);
+ this.ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_stageContextRegainedEventHandler != null)
+ {
+ this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate);
+ }
+
+ _stageContextRegainedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Stage ContextRegainedSignal
+ private void OnContextRegained()
+ {
+ ContextRegainedEventArgs e = new ContextRegainedEventArgs();
+
+ if (_stageContextRegainedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageContextRegainedEventHandler(this, e);
+ }
+ }
+
+ /**
+ * @brief Event for SceneCreated signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of SceneCreatedEventHandler) provided by the user.
+ * SceneCreated signal is emitted after the initial scene is created.
+ *
+ */
+ public event SceneCreatedEventHandler SceneCreated
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_stageSceneCreatedEventHandler == null)
+ {
+ _stageSceneCreatedEventHandler += value;
+
+ _stageSceneCreatedEventCallbackDelegate = new SceneCreatedEventCallbackDelegate(OnSceneCreated);
+ this.SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_stageSceneCreatedEventHandler != null)
+ {
+ this.SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate);
+ }
+
+ _stageSceneCreatedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Stage SceneCreatedSignal
+ private void OnSceneCreated()
+ {
+ SceneCreatedEventArgs e = new SceneCreatedEventArgs();
+
+ if (_stageSceneCreatedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _stageSceneCreatedEventHandler(this, e);
+ }
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_STAGE_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ STAGE_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ STAGE_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_STAGE_EVENTHANDLER_PARAM( Dali, Stage);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define STYLEMANAGER_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+%}
+%enddef
+
+%define STYLEMANAGER_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+/**
+ * @brief Event arguments that passed via StyleChanged signal
+ *
+ */
+public class StyleChangedEventArgs : EventArgs
+{
+ private StyleManager _styleManager;
+ private Dali.StyleChangeType _styleChange;
+
+ /**
+ * @brief StyleManager - is the StyleManager that informs applications of system theme change,
+ * and supports application theme change at runtime.
+ *
+ */
+ public StyleManager StyleManager
+ {
+ get
+ {
+ return _styleManager;
+ }
+ set
+ {
+ _styleManager = value;
+ }
+ }
+
+ /**
+ * @brief StyleChange - contains Style change information (default font changed or
+ * default font size changed or theme has changed)
+ *
+ */
+ public Dali.StyleChangeType StyleChange
+ {
+ get
+ {
+ return _styleChange;
+ }
+ set
+ {
+ _styleChange = value;
+ }
+ }
+
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void StyleChangedEventHandler(object source, StyleChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void StyleChangedCallbackDelegate(IntPtr styleManager, Dali.StyleChangeType styleChange);
+ private StyleChangedEventHandler _styleManagerStyleChangedEventHandler;
+ private StyleChangedCallbackDelegate _styleManagerStyleChangedCallbackDelegate;
+
+ /**
+ * @brief Event for StyleChanged signal which can be used to subscribe/unsubscribe the
+ * event handler (in the type of StyleChangedEventHandler) provided by the user.
+ * StyleChanged signal is is emitted after the style (e.g. theme/font change) has changed
+ * and the controls have been informed.
+ */
+ public event StyleChangedEventHandler StyleChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_styleManagerStyleChangedEventHandler == null)
+ {
+ _styleManagerStyleChangedEventHandler += value;
+
+ _styleManagerStyleChangedCallbackDelegate = new StyleChangedCallbackDelegate(OnStyleChanged);
+ this.StyleChangedSignal().Connect(_styleManagerStyleChangedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_styleManagerStyleChangedEventHandler != null)
+ {
+ this.StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate);
+ }
+
+ _styleManagerStyleChangedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for StyleManager StyleChangedsignal
+ private void OnStyleChanged(IntPtr styleManager, Dali.StyleChangeType styleChange)
+ {
+ StyleChangedEventArgs e = new StyleChangedEventArgs();
+
+ // Populate all members of "e" (StyleChangedEventArgs) with real data
+ e.StyleManager = StyleManager.GetStyleManagerFromPtr( styleManager );
+ e.StyleChange = styleChange;
+
+ if (_styleManagerStyleChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _styleManagerStyleChangedEventHandler(this, e);
+ }
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_STYLEMANAGER_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ STYLEMANAGER_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ STYLEMANAGER_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_STYLEMANAGER_EVENTHANDLER_PARAM( Dali::Toolkit, StyleManager);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define TapGesture_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+%}
+
+%enddef
+
+%define TapGesture_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+
+public class DetectedEventArgs : EventArgs
+{
+ private Actor _actor;
+ private TapGesture _tapGesture;
+
+ public Actor Actor
+ {
+ get
+ {
+ return _actor;
+ }
+ set
+ {
+ _actor = value;
+ }
+ }
+
+ public TapGesture TapGesture
+ {
+ get
+ {
+ return _tapGesture;
+ }
+ set
+ {
+ _tapGesture = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void DetectedEventHandler(object source, DetectedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture);
+ private DetectedEventHandler _tapGestureEventHandler;
+ private DetectedCallbackDelegate _tapGestureCallbackDelegate;
+
+
+ public event DetectedEventHandler Detected
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_tapGestureEventHandler == null)
+ {
+ _tapGestureEventHandler += value;
+
+ _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected);
+ this.DetectedSignal().Connect(_tapGestureCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_tapGestureEventHandler != null)
+ {
+ this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate);
+ }
+
+ _tapGestureEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture)
+ {
+ DetectedEventArgs e = new DetectedEventArgs();
+
+ // Populate all members of "e" (DetectedEventArgs) with real data
+ e.Actor = Actor.GetActorFromPtr(actor);
+ e.TapGesture = Dali.TapGesture.GetTapGestureFromPtr(tapGesture);
+
+ if (_tapGestureEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _tapGestureEventHandler(this, e);
+ }
+
+ }
+
+
+public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_tapGesture_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ TapGesture_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ TapGesture_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_tapGesture_EVENTHANDLER_PARAM( Dali, TapGestureDetector);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define TEXTEDITOR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define TEXTEDITOR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+/**
+ * @brief Event arguments that passed via TextChanged signal
+ *
+ */
+public class TextChangedEventArgs : EventArgs
+{
+ private TextEditor _textEditor;
+ /**
+ * @brief TextEditor - is the texteditor control which has the text contents changed.
+ *
+ */
+ public TextEditor TextEditor
+ {
+ get
+ {
+ return _textEditor;
+ }
+ set
+ {
+ _textEditor = value;
+ }
+ }
+}
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void TextChangedEventHandler(object source, TextChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void TextChangedCallbackDelegate(IntPtr textEditor);
+ private TextChangedEventHandler _textEditorTextChangedEventHandler;
+ private TextChangedCallbackDelegate _textEditorTextChangedCallbackDelegate;
+
+ /**
+ * @brief Event for TextChanged signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of TextChangedEventHandler) provided by the user.
+ * TextChanged signal is emitted when the text changes.
+ */
+ public event TextChangedEventHandler TextChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_textEditorTextChangedEventHandler == null)
+ {
+ _textEditorTextChangedEventHandler += value;
+
+ _textEditorTextChangedCallbackDelegate = new TextChangedCallbackDelegate(OnTextChanged);
+ this.TextChangedSignal().Connect(_textEditorTextChangedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_textEditorTextChangedEventHandler != null)
+ {
+ this.TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate);
+ }
+
+ _textEditorTextChangedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnTextChanged(IntPtr textEditor)
+ {
+ TextChangedEventArgs e = new TextChangedEventArgs();
+
+ // Populate all members of "e" (TextChangedEventArgs) with real data
+ e.TextEditor = Dali.TextEditor.GetTextEditorFromPtr(textEditor);
+
+ if (_textEditorTextChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _textEditorTextChangedEventHandler(this, e);
+ }
+
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_TEXTEDITOR_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ TEXTEDITOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ TEXTEDITOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_TEXTEDITOR_EVENTHANDLER_PARAM( Dali::Toolkit, TextEditor);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define TEXTFIELD_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+
+%enddef
+
+%define TEXTFIELD_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+public class TextChangedEventArgs : EventArgs
+{
+ private TextField _textField;
+
+ public TextField TextField
+ {
+ get
+ {
+ return _textField;
+ }
+ set
+ {
+ _textField = value;
+ }
+ }
+}
+
+public class MaxLengthReachedEventArgs : EventArgs
+{
+ private TextField _textField;
+
+ public TextField TextField
+ {
+ get
+ {
+ return _textField;
+ }
+ set
+ {
+ _textField = value;
+ }
+ }
+}
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void TextChangedEventHandler(object source, TextChangedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void MaxLengthReachedEventHandler(object source, MaxLengthReachedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void TextChangedCallbackDelegate(IntPtr textField);
+ private TextChangedEventHandler _textFieldTextChangedEventHandler;
+ private TextChangedCallbackDelegate _textFieldTextChangedCallbackDelegate;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void MaxLengthReachedCallbackDelegate(IntPtr textField);
+ private MaxLengthReachedEventHandler _textFieldMaxLengthReachedEventHandler;
+ private MaxLengthReachedCallbackDelegate _textFieldMaxLengthReachedCallbackDelegate;
+
+ public event TextChangedEventHandler TextChanged
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_textFieldTextChangedEventHandler == null)
+ {
+ _textFieldTextChangedEventHandler += value;
+
+ _textFieldTextChangedCallbackDelegate = new TextChangedCallbackDelegate(OnTextChanged);
+ this.TextChangedSignal().Connect(_textFieldTextChangedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_textFieldTextChangedEventHandler != null)
+ {
+ this.TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
+ }
+
+ _textFieldTextChangedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnTextChanged(IntPtr textField)
+ {
+ TextChangedEventArgs e = new TextChangedEventArgs();
+
+ // Populate all members of "e" (TextChangedEventArgs) with real data
+ e.TextField = Dali.TextField.GetTextFieldFromPtr(textField);
+
+ if (_textFieldTextChangedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _textFieldTextChangedEventHandler(this, e);
+ }
+
+ }
+
+ public event MaxLengthReachedEventHandler MaxLengthReached
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_textFieldMaxLengthReachedEventHandler == null)
+ {
+ _textFieldMaxLengthReachedEventHandler += value;
+
+ _textFieldMaxLengthReachedCallbackDelegate = new MaxLengthReachedCallbackDelegate(OnMaxLengthReached);
+ this.MaxLengthReachedSignal().Connect(_textFieldMaxLengthReachedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_textFieldMaxLengthReachedEventHandler != null)
+ {
+ this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
+ }
+
+ _textFieldMaxLengthReachedEventHandler -= value;
+ }
+ }
+ }
+
+ private void OnMaxLengthReached(IntPtr textField)
+ {
+ MaxLengthReachedEventArgs e = new MaxLengthReachedEventArgs();
+
+ // Populate all members of "e" (MaxLengthReachedEventArgs) with real data
+ e.TextField = Dali.TextField.GetTextFieldFromPtr(textField);
+
+ if (_textFieldMaxLengthReachedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _textFieldMaxLengthReachedEventHandler(this, e);
+ }
+
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+%define DALI_TEXTFIELD_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ TEXTFIELD_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ TEXTFIELD_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_TEXTFIELD_EVENTHANDLER_PARAM( Dali::Toolkit, TextField);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define TIMER_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define TIMER_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+ /**
+ * @brief Event arguments that passed via Tick signal
+ *
+ */
+ public class TickEventArgs : EventArgs
+ {
+ }
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate bool TickEventHandler(object source, TickEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate bool TickCallbackDelegate(IntPtr data);
+ private TickEventHandler _timerTickEventHandler;
+ private TickCallbackDelegate _timerTickCallbackDelegate;
+
+ /**
+ * @brief Event for Ticked signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of TickEventHandler) provided by the user.
+ * Ticked signal is emitted after specified time interval.
+ */
+ public event TickEventHandler Ticked
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_timerTickEventHandler == null)
+ {
+ _timerTickEventHandler += value;
+
+ _timerTickCallbackDelegate = new TickCallbackDelegate(OnTick);
+ this.TickSignal().Connect(_timerTickCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_timerTickEventHandler != null)
+ {
+ this.TickSignal().Disconnect(_timerTickCallbackDelegate);
+ }
+
+ _timerTickEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for Timer Tick signal
+ private bool OnTick(IntPtr data)
+ {
+ TickEventArgs e = new TickEventArgs();
+
+ if (_timerTickEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ return _timerTickEventHandler(this, e);
+ }
+ return false;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_TIMER_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ TIMER_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ TIMER_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_TIMER_EVENTHANDLER_PARAM( Dali::Adaptor, Timer);
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+%define VIDEOVIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
+%typemap(csimports) NameSpace::ClassName %{
+using System;
+using System.Runtime.InteropServices;
+
+%}
+%enddef
+
+%define VIDEOVIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
+%typemap(cscode) NameSpace::ClassName %{
+
+/**
+ * @brief Event arguments that passed via Finished signal
+ *
+ */
+public class FinishedEventArgs : EventArgs
+{
+ private VideoView _videoView;
+
+ /**
+ * @brief VideoView - VideoView is a control for video playback and display.
+ *
+ */
+ public VideoView VideoView
+ {
+ get
+ {
+ return _videoView;
+ }
+ set
+ {
+ _videoView = value;
+ }
+ }
+}
+
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ public delegate void FinishedEventHandler(object source, FinishedEventArgs e);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void FinishedCallbackDelegate(IntPtr data);
+ private FinishedEventHandler _videoViewFinishedEventHandler;
+ private FinishedCallbackDelegate _videoViewFinishedCallbackDelegate;
+
+ /**
+ * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler
+ * (in the type of FinishedEventHandler) provided by the user.
+ * Finished signal is emitted when a video playback have finished.
+ */
+ public event FinishedEventHandler Finished
+ {
+ add
+ {
+ lock(this)
+ {
+ // Restricted to only one listener
+ if (_videoViewFinishedEventHandler == null)
+ {
+ _videoViewFinishedEventHandler += value;
+
+ _videoViewFinishedCallbackDelegate = new FinishedCallbackDelegate(OnFinished);
+ this.FinishedSignal().Connect(_videoViewFinishedCallbackDelegate);
+ }
+ }
+ }
+
+ remove
+ {
+ lock(this)
+ {
+ if (_videoViewFinishedEventHandler != null)
+ {
+ this.FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
+ }
+
+ _videoViewFinishedEventHandler -= value;
+ }
+ }
+ }
+
+ // Callback for VideoView Finished signal
+ private void OnFinished(IntPtr data)
+ {
+ FinishedEventArgs e = new FinishedEventArgs();
+
+ // Populate all members of "e" (FinishedEventArgs) with real data
+ e.VideoView = VideoView.GetVideoViewFromPtr( data );
+
+ if (_videoViewFinishedEventHandler != null)
+ {
+ //here we send all data to user event handlers
+ _videoViewFinishedEventHandler(this, e);
+ }
+ }
+
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+%}
+
+%enddef
+
+
+%define DALI_VIDEOVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
+
+ VIDEOVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
+ VIDEOVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
+
+%enddef
+
+namespace Dali
+{
+ DALI_VIDEOVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, VideoView);
+}
--- /dev/null
+ /*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+ /**
+ * WARNING: The macro below may be over-ridden by any other typemap(cscode)
+ * customisation for a class.
+ *
+ * MACRO to inject a C# function in to a SWIG generated DALi C# wrapper class.
+ * The MACRO allow you to create a C# wrapper class for a DALi C++ object (passed as a C PTR).
+ *
+ * Required to get access to any data passed as a parameter in a Signal ( in C# they are delegate parameters).
+ * E.g.
+ *
+ * CREATE_CSHARP_WRAPPER_FROM_C_PTR_FUNCTION( TouchData );
+ * Creates a function called GetTouchDataFromPtr which allows you to:
+ *
+ * static void OnStageTouched(IntPtr data)
+ * {
+ * TouchData touchData = TouchData.GetTouchDataFromPtr( data );
+ * }
+ *
+ * ## means concat in a SWIG macro
+ */
+
+%define DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( NameSpace, ClassName )
+
+ %typemap(cscode) NameSpace::ClassName %{
+ public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
+ ClassName ret = new ClassName(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+%}
+
+%enddef
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Application );
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Actor );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Image );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, ResourceImage );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Animation );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TouchData );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, HoverEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, WheelEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, KeyEvent );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, LongPressGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PanGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PinchGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, TapGesture );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, PropertyNotification );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, BaseHandle );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, RefObject );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, RenderTask );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, Vector2 );
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, AccessibilityManager );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali, StyleManager );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, Control );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, Button );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, GaussianBlurView );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, PageTurnView );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, TextEditor );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, TextField );
+
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, TextField );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, VideoView );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit, Slider );
+DALI_CREATE_C_PTR_TO_CSHARP_FUNCTION( Dali::Toolkit::ScrollView, SnapEvent );
+
+
+
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// Example from Swig CSHARP documentation
+// To allow a CDate class to take
+// To achieve this mapping, we need to alter the default code generation slightly so that at the C# layer, a System.DateTime is converted into a CDate. The
+// intermediary layer will still take a pointer to the underlying CDate class. The typemaps to achieve this are shown below.
+
+// %typemap(cstype) const CDate & "System.DateTime"
+// %typemap(csin,
+// pre="
+// CDate temp$csinput = new CDate($csinput.Year, $csinput.Month, $csinput.Day);"
+// ) const CDate &
+// "$csclassname.getCPtr(temp$csinput)"
+// The csin typemap is used for converting function parameter types from the type
+// used in the proxy, module or type wrapper class to the type used in the PInvoke class.
+
+
+%include <dali/public-api/signals/dali-signal.h>
+
+/*
+ * By default SWIG maps Derived types, structs, and classes to C pointers.
+ * So for Signals which have a Connect /Disconnect function, the function parameter just gets maps to a C pointer.
+ * However, call backs in C# are done using delegates, so we change the Connect / Disconnect parameter from
+ * something like void (*func)( Dali::Actor ) to a C# delegate.
+ * the parameter type is changed using the typemap(cstype) cstype = csharp-type
+ * The actual conversion from a C# delegate to a c function pointer is done when Connect/Disconnect is called
+ * using typemap(csin) with GetFunctionPointerForDelegate ( csin = csharp in code?).
+ * So when connect is called on a Signal it will call the void Signal::Connect( void (*func)( Arg0 arg0 ) ) -- which
+ * just takes a standard C function pointer. Not ideal as there is no delegate / connection tracking.
+ *
+ */
+%define SIGNAL_TYPEMAP_HELPER( SignalSignature )
+%typemap(cstype) SignalSignature "System.Delegate"
+%typemap(csin, pre ="System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate($csinput); ")
+ SignalSignature "new System.Runtime.InteropServices.HandleRef(this, ip)"
+%enddef
+
+/**
+ * SWIG can't auto generate wrappers for template parameters that are functions ( which dali-signal has)
+ * so we have make them ourselves
+ */
+
+%define SIGNAL_TEMPLATE_HELPER_0( returnType, returnFunc)
+ template<> class Signal< returnType () >
+ {
+ public:
+ %extend
+ {
+ bool Empty() const
+ {
+ return $self->Empty();
+ }
+ std::size_t GetConnectionCount() const
+ {
+ return $self->GetConnectionCount();
+ }
+ void Connect( returnType ( *func ) () )
+ {
+ $self->Connect( func );
+ }
+ void Disconnect( returnType ( *func ) () )
+ {
+ $self->Disconnect( func );
+ }
+ returnType Emit()
+ {
+ returnFunc $self->Emit();
+ }
+ }
+ };
+%enddef
+
+%define SIGNAL_TEMPLATE_HELPER_1( returnType, returnFunc, argumentType )
+ template<> class Signal< returnType ( argumentType ) >
+ {
+ public:
+ %extend
+ {
+ bool Empty() const
+ {
+ return $self->Empty();
+ }
+ std::size_t GetConnectionCount() const
+ {
+ return $self->GetConnectionCount();
+ }
+ void Connect( returnType ( *func ) ( argumentType ) )
+ {
+ $self->Connect( func );
+ }
+ void Disconnect( returnType ( *func ) ( argumentType ) )
+ {
+ $self->Disconnect( func );
+ }
+ returnType Emit( argumentType arg)
+ {
+ returnFunc $self->Emit( arg );
+ }
+ }
+ };
+%enddef
+
+%define SIGNAL_TEMPLATE_HELPER_2( returnType, returnFunc, argumentType1, argumentType2 )
+ template<> class Signal< returnType ( argumentType1, argumentType2 ) >
+ {
+ public:
+ %extend
+ {
+ bool Empty() const
+ {
+ return $self->Empty();
+ }
+ std::size_t GetConnectionCount() const
+ {
+ return $self->GetConnectionCount();
+ }
+ void Connect( returnType ( *func ) ( argumentType1, argumentType2 ) )
+ {
+ $self->Connect( func );
+ }
+ void Disconnect( returnType ( *func ) ( argumentType1, argumentType2 ) )
+ {
+ $self->Disconnect( func );
+ }
+ returnType Emit( argumentType1 arg1, argumentType2 arg2 )
+ {
+ returnFunc $self->Emit( arg1, arg2 );
+ }
+ }
+ };
+%enddef
+
+%define SIGNAL_TEMPLATE_HELPER_3( returnType, returnFunc, argumentType1, argumentType2, argumentType3 )
+ template<> class Signal< returnType ( argumentType1, argumentType2, argumentType3 ) >
+ {
+ public:
+ %extend
+ {
+ bool Empty() const
+ {
+ return $self->Empty();
+ }
+ std::size_t GetConnectionCount() const
+ {
+ return $self->GetConnectionCount();
+ }
+ void Connect( returnType ( *func ) ( argumentType1, argumentType2, argumentType3 ) )
+ {
+ return $self->Connect( func );
+ }
+ void Disconnect( returnType ( *func ) ( argumentType1, argumentType2, argumentType3 ) )
+ {
+ $self->Disconnect( func );
+ }
+ returnType Emit( argumentType1 arg1, argumentType2 arg2, argumentType3 arg3 )
+ {
+ returnFunc $self->Emit( arg1, arg2, arg3 );
+ }
+ }
+ };
+%enddef
+
+////////////////////////////////
+/*****************
+ Macros for signals without return values
+*****************/
+
+// the emit for some signal has to emit a return value
+// this macro is just for signals that don't (instead of return Emit();.. it just does ;Emit();
+%define NO_RETURN_FUNC;
+%enddef
+
+// Macro to define a csharp signal.
+// 0 param signals ( no return )
+%define DALI_SIGNAL_0_PARAM()
+
+ SIGNAL_TYPEMAP_HELPER( void (*func) () );
+ SIGNAL_TEMPLATE_HELPER_0( void, NO_RETURN_FUNC);
+%enddef
+
+// 1 param signals ( no return )
+%define DALI_SIGNAL_1_PARAM( argumentType1 )
+
+ SIGNAL_TYPEMAP_HELPER( void (*func) ( argumentType1 ) );
+ SIGNAL_TEMPLATE_HELPER_1( void, NO_RETURN_FUNC, argumentType1);
+%enddef
+
+// 2 param signals ( no return )
+%define DALI_SIGNAL_2_PARAM( argumentType1, argumentType2)
+
+ SIGNAL_TYPEMAP_HELPER( void (*func) ( argumentType1, argumentType2) );
+ SIGNAL_TEMPLATE_HELPER_2( void, NO_RETURN_FUNC, argumentType1, argumentType2);
+
+%enddef
+
+// 3 param signals ( no return )
+%define DALI_SIGNAL_3_PARAM( argumentType1, argumentType2, argumentType3 )
+
+ SIGNAL_TYPEMAP_HELPER( void (*func) ( argumentType1, argumentType2, argumentType3 ) );
+ SIGNAL_TEMPLATE_HELPER_3( void, NO_RETURN_FUNC, argumentType1, argumentType2, argumentType3);
+
+%enddef
+
+/*****************
+ Macros for signals with return values
+*****************/
+
+// 1 param signals ( with return )
+%define DALI_SIGNAL_1_PARAM_RETURN( returnType, argumentType1 )
+
+ SIGNAL_TYPEMAP_HELPER( returnType (*func) ( argumentType1 ) );
+ SIGNAL_TEMPLATE_HELPER_1( returnType, return, argumentType1);
+
+%enddef
+
+// 2 param signals ( with return )
+%define DALI_SIGNAL_2_PARAM_RETURN( returnType, argumentType1, argumentType2)
+
+ SIGNAL_TYPEMAP_HELPER( returnType (*func) ( argumentType1, argumentType2) );
+ SIGNAL_TEMPLATE_HELPER_2( returnType, return, argumentType1, argumentType2);
+
+%enddef
+
+// 3 param signals ( with return )
+%define DALI_SIGNAL_3_PARAM_RETURN( returnType, argumentType1, argumentType2, argumentType3 )
+
+ SIGNAL_TYPEMAP_HELPER( returnType (*func) ( argumentType1, argumentType2, argumentType3 ) );
+ SIGNAL_TEMPLATE_HELPER_3( returnType, return, argumentType1, argumentType2, argumentType3);
+
+%enddef
+
+namespace Dali
+{
+// Signal< void () >
+DALI_SIGNAL_0_PARAM();
+
+// Signal< void (Actor) >
+DALI_SIGNAL_1_PARAM( Dali::Actor );
+
+// Signal< void (float) >
+DALI_SIGNAL_1_PARAM( float );
+
+// Signal< void (Dali::Application&) >
+DALI_SIGNAL_1_PARAM( Dali::Application& );
+
+// Signal< void (Dali::Application&, void*) >
+DALI_SIGNAL_2_PARAM( Dali::Application& , void* );
+
+// Signal< void (Dali::Image) >
+DALI_SIGNAL_1_PARAM( Dali::Image );
+
+// Signal< void (Dali::ResourceImage) >
+DALI_SIGNAL_1_PARAM( Dali::ResourceImage );
+
+// Signal< void (Dali::Animation&) >
+DALI_SIGNAL_1_PARAM( Dali::Animation& );
+
+// Signal< void (Dali::Actor, const Dali::TouchEvent&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::TouchEvent& );
+
+// Signal< bool (Dali::Actor, const Dali::TouchData&) >
+DALI_SIGNAL_2_PARAM_RETURN( bool, Dali::Actor, const Dali::TouchData& );
+
+// Signal< bool (Dali::Actor, const Dali::HoverEvent&) >
+DALI_SIGNAL_2_PARAM_RETURN( bool , Dali::Actor, const Dali::HoverEvent& );
+
+// Signal< bool (Dali::Actor, const Dali::WheelEvent&) >
+DALI_SIGNAL_2_PARAM_RETURN( bool , Dali::Actor, const Dali::WheelEvent& );
+
+// Signal< void (const Dali::KeyEvent&) >
+DALI_SIGNAL_1_PARAM( const Dali::KeyEvent& );
+
+// Signal< void (const Dali::TouchData&) >
+DALI_SIGNAL_1_PARAM( const Dali::TouchData& );
+
+// Signal< void (const Dali::HoverEvent&) >
+DALI_SIGNAL_1_PARAM( const Dali::HoverEvent& );
+
+// Signal< void (const Dali::WheelEvent&) >
+DALI_SIGNAL_1_PARAM( const Dali::WheelEvent& );
+
+// Signal< void (const Dali::LongPressGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::LongPressGesture& );
+
+// Signal< void (Dali::Actor, const Dali::PanGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::PanGesture& );
+
+// Signal< void (Dali::Actor, const Dali::PinchGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::PinchGesture& );
+
+// Signal< void (Dali::Actor, const Dali::TapGesture&) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, const Dali::TapGesture& );
+
+// Signal< void (Dali::PropertyNotification) >
+DALI_SIGNAL_1_PARAM( Dali::PropertyNotification& ) ;
+
+// Signal< void (Dali::BaseHandle) >
+DALI_SIGNAL_1_PARAM( Dali::BaseHandle );
+
+// Signal< void (const Dali::RefObject*) >
+DALI_SIGNAL_1_PARAM( const Dali::RefObject* );
+
+// Signal< void (const Dali::RenderTask&) >
+DALI_SIGNAL_1_PARAM( const Dali::RenderTask& );
+
+// Signal< bool ( const Dali::Toolkit::AccessibilityManager& ) >
+DALI_SIGNAL_1_PARAM_RETURN( bool ,Dali::Toolkit::AccessibilityManager& );
+
+// Signal< bool ( const Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent& ) >
+DALI_SIGNAL_2_PARAM_RETURN( bool ,const Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent& );
+
+// Signal< void ( const Dali::Actor Dali::Toolkit::AccessibilityManager::FocusOvershotDirection ) >
+DALI_SIGNAL_2_PARAM( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection );
+
+// Signal< bool ( Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent& ) >
+DALI_SIGNAL_2_PARAM_RETURN( bool ,Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&);
+
+// Signal< void ( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection) >
+//DALI_SIGNAL_2_PARAM( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection );
+
+// Signal< void ( Dali::Toolkit::StyleManager, Dali::StyleChange::Type) >
+DALI_SIGNAL_2_PARAM( Dali::Toolkit::StyleManager, Dali::StyleChange::Type);
+
+// Signal< void ( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection )>
+//DALI_SIGNAL_2_PARAM( Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection );
+
+// Signal< Dali::Actor ( Dali::Actor, Dali::Actor, Dali::Actor, Dali::Toolkit::Control::KeyboardFocus::Direction) >
+DALI_SIGNAL_3_PARAM_RETURN( Dali::Actor, Dali::Actor, Dali::Actor, Dali::Toolkit::Control::KeyboardFocus::Direction);
+
+// void Signal< Dali::Actor, bool >;
+DALI_SIGNAL_2_PARAM( Dali::Actor, bool);
+
+// void Signal< Dali::Actor, Dali::Actor >;
+DALI_SIGNAL_2_PARAM( Dali::Actor, Dali::Actor);
+
+// bool Signal< Dali::Toolkit::Button >;
+DALI_SIGNAL_1_PARAM_RETURN( bool, Dali::Toolkit::Button);
+
+// void Signal< Dali::Toolkit::GaussianBlurView >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::GaussianBlurView);
+
+// void Signal< Dali::Toolkit::PageTurnView, unsigned int, bool >;
+DALI_SIGNAL_3_PARAM( Dali::Toolkit::PageTurnView, unsigned int, bool );
+
+// void Signal< Dali::Toolkit::PageTurnView >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::PageTurnView );
+
+// void Signal< const Dali::Toolkit::ScrollView::SnapEvent& >;
+DALI_SIGNAL_1_PARAM( const Dali::Toolkit::ScrollView::SnapEvent& );
+
+// void Signal< const Dali::Vector2& >;
+DALI_SIGNAL_1_PARAM( const Dali::Vector2& );
+
+// void Signal< Dali::Toolkit::TextEditor >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::TextEditor );
+
+// void Signal< Dali::Toolkit::TextField >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::TextField );
+
+// bool Signal< Dali::Toolkit::Control, const Dali::KeyEvent& >;
+DALI_SIGNAL_2_PARAM_RETURN( bool, Dali::Toolkit::Control, const Dali::KeyEvent& );
+
+// void Signal< Dali::Toolkit::Control >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::Control );
+
+// void Signal< Dali::Toolkit::VideoView& >;
+DALI_SIGNAL_1_PARAM( Dali::Toolkit::VideoView& );
+
+// Signal< bool (Dali::Toolkit::Slider, float) >;
+DALI_SIGNAL_2_PARAM_RETURN( bool,Dali::Toolkit::Slider, float );
+
+// Signal< bool(Dali::Toolkit::Slider, int) >;
+DALI_SIGNAL_2_PARAM_RETURN( bool,Dali::Toolkit::Slider, int );
+
+} // namespace DALi
+
+
--- /dev/null
+#!/bin/sh
+
+# Run this to generate all the auto-generated files needed by the GNU
+# configure program
+
+autoreconf --force --install
+
--- /dev/null
+# 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.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Process this file with autoconf to produce a configure script.
+AC_INIT([Dali-SWIG], [0.1.1],
+ [Dali-SWIG])
+AC_PREREQ(2.50)
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE([-Wall foreign])
+
+# check target
+AC_MSG_CHECKING([system])
+target=`uname`
+AC_MSG_RESULT([$target])
+
+# check compiler
+AC_LANG([C++])
+
+# check for Dali libraries
+PKG_CHECK_MODULES(DALICORE, dali-core)
+PKG_CHECK_MODULES(DALIADAPTOR, dali-adaptor)
+PKG_CHECK_MODULES(DALITOOLKIT, dali-toolkit)
+
+# check for tools
+AC_PATH_PROG([SWIG], [swig])
+AC_PATH_PROG([RUBY], [ruby])
+
+AC_PATH_PROGS([MCS], [gmcs mcs gmcs2])
+AM_CONDITIONAL(HAVE_MCS, test "x${MCS}" != "x")
+
+AC_ARG_ENABLE([csharp],
+ AC_HELP_STRING([--disable-csharp],
+ [If disabled, the C# module
+ will not be built]),
+ [build_mcs=$enableval],
+ [build_mcs=yes])
+AM_CONDITIONAL(BUILD_MCS, test "$build_mcs" != "no")
+
+# flags
+
+case "$target" in
+Darwin)
+ AC_SUBST([SHARED_LIB],[${SHARED_LIB='-dynamiclib'}])
+ AC_SUBST([JNILIB_EXTENSION],[${JNILIB_EXTENSION='jnilib'}]) ;;
+*)
+ AC_SUBST([SHARED_LIB],[${SHARED_LIB='-shared'}])
+ AC_SUBST([JNILIB_EXTENSION],[${JNILIB_EXTENSION='so'}]) ;;
+esac
+
+
+# done, output the configured files
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+
--- /dev/null
+#!/usr/bin/env ruby
+# encoding: utf-8
+require 'pathname'
+require 'scanf'
+require 'fileutils'
+#
+# DALi traditonally use a static New function to create an object.
+# E.g. Actor myActor = Actor::New();
+#
+# However it has been request that for the CSharp DALi API we this coding convention
+#
+# Actor myActor = new Actor();
+#
+# Script does the follow:
+#
+# - greps dali csharp wrapper files for the class constructor (new Actor()) and the static New() e.g. functions ( TextLabel::New(), TextLabel::New( string label) )
+#
+# regexp for searching swig generated constructors grep -oP -n 'public [A-Z]([A-Z]*[a-z])*\(\)' *
+# regexp for searching for swig genereated New functions grep -oP -n -i 'static [a-zA-Z]\+ New'
+
+
+$fileHeader = "/*"\
+ "* Copyright (c) #{Time.now.year} Samsung Electronics Co., Ltd.\n"\
+ "*\n"\
+ "* Licensed under the Apache License, Version 2.0 (the \"License\");\n"\
+ "* you may not use this file except in compliance with the License.\n"\
+ "* You may obtain a copy of the License at\n"\
+ "*\n"\
+ "* http://www.apache.org/licenses/LICENSE-2.0\n"\
+ "*\n"\
+ "* Unless required by applicable law or agreed to in writing, software\n"\
+ "* distributed under the License is distributed on an \"AS IS\" BASIS,\n"\
+ "* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"\
+ "* See the License for the specific language governing permissions and\n"\
+ "* limitations under the License.\n"\
+ "*\n"\
+ "*/\n"\
+ "// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts\n"
+
+# global paths
+$rootPath = ""
+$daliCSharpPath = ""
+$totalDaliClasses = 0
+$totalConstructorsGenerated = 0
+
+
+$swigConstructorNumLines = 3
+$swigNewFuncNumLines = 4
+
+
+# daliClass struct stores information about where the constructor / static New functions are in the file
+$daliClassStruct = Struct.new("DaliClass", :name, :file, :hasNewFunction, :hasConstructor, :constructorLine, :staticNewLines, :generatedConstructors)
+
+# Array
+$daliClassArray = Array.new
+
+def init
+
+ pn = Pathname.new(Dir.pwd)
+ fullPath = pn.to_s
+
+ $rootPath = fullPath.slice(0..( fullPath.index('/dali-toolkit')))
+ $daliCSharpPath = $rootPath + "dali-toolkit/plugins/dali-swig/csharp"
+ puts("--------------------------------------------")
+ puts("Modifying constructors for DALi C# files ")
+ puts("E.g. modify TextLabel::New() ==> new TextLabel() ")
+ puts("")
+
+
+end
+
+def getDaliClassItem( className )
+
+ # puts( "getDaliClassItem "+ className )
+ index = $daliClassArray.index{ |a| a.name == className }
+
+ if( index == nil)
+ # create a new item along with a array for it's properites
+ classItem = $daliClassStruct.new( className );
+
+ classItem.name = className
+ classItem.hasNewFunction = false
+ classItem.hasConstructor = false
+ classItem.generatedConstructors = Array.new
+ classItem.staticNewLines = Array.new
+
+ $daliClassArray.push( classItem )
+
+ else
+
+ classItem = $daliClassArray[ index ]
+ end
+
+ return classItem;
+
+end
+
+def grepConstructorInfo
+
+ # grep for strings like public Actor(), have to use double black slash on the parenthesis for some reason
+ result =`grep -oP -n "public [A-Z]([A-Z]*[0-9]*[a-z])*\\(\\)" #{$daliCSharpPath}/*`
+
+ # result is an array of lines that look like this:
+ # /homepath/dali-toolkit/plugins/dali-swig/csharp/Window.cs:66:public Window()
+
+ lines = result.split(/\n+/);
+ for line in lines
+
+ # Split the line into file name, line number
+ data = line.split(":",3)
+ fileName = data[0];
+ lineNum = data[1]
+
+
+ # Get the class name from the filename
+ className = File.basename(fileName,".cs")
+
+ # get or create a new DALi class item which stores the new / constructor information
+ classItem = getDaliClassItem( className )
+
+ classItem.file = fileName
+ classItem.constructorLine = lineNum.to_i
+ classItem.hasConstructor = true
+ # puts classItem.name
+
+ end
+
+end
+
+
+
+def grepStaticNewInfo
+
+ # grep for strings like static Actor::New()
+ result =`grep -oP -n -i "static [a-zA-Z0-9]\+ New" #{$daliCSharpPath}/*`
+
+ lines = result.split(/\n+/);
+ for line in lines
+
+ #puts line
+ # Split the line into file name and property macro, split 2 means just create two strings
+ data = line.split(":",3)
+ fileName = data[0];
+ lineNum = data[1]
+
+ # # Get the class name from the filename ( e.g. image-actor-impl.cpp => image-actor)
+ className = File.basename(fileName,".cs")
+
+ # get or create a new DALi class item which stores the property information
+ classItem = getDaliClassItem( className )
+
+ classItem.file = fileName
+ classItem.hasNewFunction = true
+ classItem.staticNewLines.push( lineNum.to_i )
+ # puts "added line number #{lineNum} for #{classItem.name}"
+
+ end
+
+end
+
+
+
+
+def generateNewConstructors
+ todo = 2
+
+ for daliClass in $daliClassArray
+
+ # if the class doesn't have a New function and a constructor then skip it
+ if ! (daliClass.hasNewFunction && daliClass.hasConstructor)
+ #puts( "Doesn't have a New function #{daliClass.file}" )
+ next
+ end
+
+ File.open(daliClass.file, 'r+') do |file|
+
+ currentLine = 0
+ for newEntryLine in daliClass.staticNewLines
+ linesToRead = newEntryLine - currentLine -1
+ # puts("lineToRead = #{linesToRead} #{newEntryLine}")
+ linesToRead.times{ file.gets }
+
+ currentLine += linesToRead +$swigConstructorNumLines # +3 for 3 lines of the New function that we read in below
+ line = file.readline
+ #puts("line = #{line} _________")
+ parameterString = /\((.*)\)/.match(line) # pulls out the New parameter e.g. (float duration)
+
+ #read the next line
+ #file.gets
+ line = file.readline
+ constructorCall = /\((.*)\)/.match(line) # pulls out the constructor call e.g. ((NDalicPINVOKE.TextLabel_New__SWIG_1(text), true))
+
+ exceptionLine = file.readline
+
+ #res = file.line.line.grep(/asd/i)
+ constructorCode = " public #{daliClass.name} #{parameterString} : this #{constructorCall} {\n"\
+ " #{exceptionLine}\n"\
+ " }\n"
+
+
+ daliClass.generatedConstructors.push( constructorCode )
+ #puts constructorCode
+ end # for
+ end # file open
+ end # for
+end
+
+def InjectConstructors( daliClass, file )
+
+ for code in daliClass.generatedConstructors
+ file.puts( code )
+ #puts code
+ $totalConstructorsGenerated+=1
+ end
+end
+
+def lineShouldBeSkipped(daliClass, line)
+
+ if line.between?(daliClass.constructorLine-1, daliClass.constructorLine+$swigConstructorNumLines -1)
+ return true
+ end
+
+
+ for n in daliClass.staticNewLines
+ if line.between?(n-1, n+$swigNewFuncNumLines )
+ return true
+ end
+ end
+
+ return false
+end
+
+
+# helper class to color the background
+class String
+def blueBackground; "\e[45m#{self}\e[0m" end
+end
+
+def updateCSharpFiles
+
+ # we now have a populated array of daliClassStructs.
+ # With each class we open it's SWIG generated csharp file
+ # create a new temp file, and copy the SWIG generated code over to the temporary one
+ # except for the existing constructors and New() functions. e.g. Actor() and Actor::New()
+ # We also inject our new constructor functions e.g. Actor()
+
+ for daliClass in $daliClassArray
+ # puts "writing file #{daliClass.name}..."
+
+ # check the class has some constructors to write
+ if (daliClass.generatedConstructors.length == 0 )
+ # puts "no constructors for #{daliClass.name}..."
+ next
+ end
+
+ if daliClass.name == "Application"
+ next
+ end
+
+ $totalDaliClasses+=1 # for stats
+
+ # create a file to store the modified output
+ tempFileName = "#{daliClass.file}.tmp"
+ tempFile = File.new(tempFileName, 'w')
+
+ tempFile.puts $fileHeader
+ currentLine = 0
+ # open the the file
+ constructorsWritten = false
+
+ File.open(daliClass.file, 'r') do |file|
+
+ file.each do |line|
+
+ if lineShouldBeSkipped( daliClass, currentLine ) # lineShouldBeSkipped ( daliClass, currentLine )
+ currentLine +=1
+ if( !constructorsWritten )
+ # inject our newly generated constructors
+ InjectConstructors( daliClass, tempFile );
+ puts("Converting static Class::New(xxx) ---> new Class(xxx) into #{daliClass.name}".blueBackground)
+
+ constructorsWritten = true # only write our new constructors to the file once
+ end
+ next
+ end # line should be skipped
+
+ currentLine +=1
+ tempFile.puts( line )
+
+ end # file each
+ end # file open
+
+ tempFile.close
+
+ # copy the temp file over the top of the exiting file
+ FileUtils.mv tempFileName, daliClass.file
+
+ end
+ puts"\n"
+ puts("Done. Generated #{$totalConstructorsGenerated} Constructors for #{$totalDaliClasses} DALi C# classes".blueBackground)
+
+
+
+end
+
+init
+grepConstructorInfo
+grepStaticNewInfo
+generateNewConstructors
+updateCSharpFiles
+
+
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// DaliWrapper.cpp : Defines the entry point for the DLL application.
+//
+
+#include "stdafx.h"
+#include "DaliWrapper.h"
+
+BOOL APIENTRY DllMain( HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+// This is an example of an exported variable
+DALIWRAPPER_API int nDaliWrapper=0;
+
+// This is an example of an exported function.
+DALIWRAPPER_API int fnDaliWrapper(void)
+{
+ return 18;
+}
+
+// This is the constructor of a class that has been exported.
+// see DaliWrapper.h for the class definition
+CDaliWrapper::CDaliWrapper()
+{
+ return;
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// The following ifdef block is the standard way of creating macros which make exporting
+// from a DLL simpler. All files within this DLL are compiled with the DALIWRAPPER_EXPORTS
+// symbol defined on the command line. this symbol should not be defined on any project
+// that uses this DLL. This way any other project whose source files include this file see
+// DALIWRAPPER_API functions as being imported from a DLL, whereas this DLL sees symbols
+// defined with this macro as being exported.
+
+#ifdef DALIWRAPPER_EXPORTS
+#define DALIWRAPPER_API __declspec(dllexport)
+#else
+#define DALIWRAPPER_API __declspec(dllimport)
+#endif
+
+// This class is exported from the DaliWrapper.dll
+class DALIWRAPPER_API CDaliWrapper
+{
+
+public:
+ CDaliWrapper(void);
+ // TODO: add your methods here.
+
+};
+
+extern DALIWRAPPER_API int nDaliWrapper;
+
+DALIWRAPPER_API int fnDaliWrapper(void);
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+// Windows Header Files:
+#include <windows.h>
+
+// TODO: reference additional headers your program requires here
--- /dev/null
+*
+!.gitignore
\ No newline at end of file
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+
+namespace MyCSharpExample
+{
+ class Example
+ {
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void CallbackDelegate(IntPtr appPtr); // void, void delgate
+
+ private Dali.Application _application;
+
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
+
+ _application.Initialized += new Dali.AUIApplicationInitEventHandler(Initialize);
+ Console.WriteLine( "InitSignal connection count = " + _application.InitSignal().GetConnectionCount() );
+ }
+
+ public void Initialize(object source, AUIApplicationInitEventArgs e)
+ {
+ Handle handle = new Handle();
+ int myPropertyIndex = handle.RegisterProperty("myProperty", new Property.Value(10.0f), Property.AccessMode.READ_WRITE);
+ float myProperty = 0.0f;
+ handle.GetProperty(myPropertyIndex).Get(ref myProperty);
+ Console.WriteLine( "myProperty value: " + myProperty );
+
+ int myPropertyIndex2 = handle.RegisterProperty("myProperty2", new Property.Value(new Vector2(5.0f, 5.0f)), Property.AccessMode.READ_WRITE);
+ Vector2 myProperty2 = new Vector2(0.0f, 0.0f);
+ handle.GetProperty(myPropertyIndex2).Get(myProperty2);
+ Console.WriteLine( "myProperty2 value: " + myProperty2.x + ", " + myProperty2.y );
+
+ Actor actor = new Actor();
+ actor.Size = new Vector3(200.0f, 200.0f, 0.0f);
+ actor.Name = "MyActor";
+ actor.Color = new Vector4(1.0f, 0.0f, 1.0f, 0.8f);
+ Console.WriteLine("Actor id: {0}", actor.GetId());
+ Console.WriteLine("Actor size: " + actor.Size.x + ", " + actor.Size.y);
+ Console.WriteLine("Actor name: " + actor.Name);
+
+ Stage stage = Stage.GetCurrent();
+ stage.SetBackgroundColor( NDalic.WHITE );
+
+ Vector2 stageSize = stage.GetSize();
+ Console.WriteLine("Stage size: " + stageSize.x + ", " + stageSize.y);
+ stage.Add(actor);
+
+ TextLabel text = new TextLabel("Hello Mono World");
+ text.ParentOrigin = NDalic.ParentOriginCenter;
+ text.AnchorPoint = NDalic.AnchorPointCenter;
+ text.HorizontalAlignment = "CENTER";
+ stage.Add(text);
+
+ Console.WriteLine( "Text label text: " + text.Text );
+
+ Console.WriteLine( "Text label point size: " + text.PointSize );
+ text.PointSize = 32.0f;
+ Console.WriteLine( "Text label new point size: " + text.PointSize );
+
+ using (RectInteger ri = new RectInteger(02,05,20,30))
+ {
+ Console.WriteLine( " Created " + ri );
+ Console.WriteLine( " IsEmpty() = " + ri.IsEmpty() );
+ Console.WriteLine( " Left = " + ri.Left() );
+ Console.WriteLine( " Right = " + ri.Right() );
+ Console.WriteLine( " Top = " + ri.Top() );
+ Console.WriteLine( " Bottom = " + ri.Bottom() );
+ Console.WriteLine( " Area = " + ri.Area() );
+ }
+ Console.WriteLine( " *************************" );
+ using (RectInteger ri2 = new RectInteger(02,05,20,30))
+ {
+ Console.WriteLine( " Created " + ri2 );
+ ri2.Set(1,1,40,40);
+ Console.WriteLine( " IsEmpty() = " + ri2.IsEmpty() );
+ Console.WriteLine( " Left = " + ri2.Left() );
+ Console.WriteLine( " Right = " + ri2.Right() );
+ Console.WriteLine( " Top = " + ri2.Top() );
+ Console.WriteLine( " Bottom = " + ri2.Bottom() );
+ Console.WriteLine( " Area = " + ri2.Area() );
+ }
+ Console.WriteLine( " *************************" );
+ using (RectDouble rd = new RectDouble(02,05,20.5,30.5))
+ {
+ Console.WriteLine( " Created " + rd );
+ Console.WriteLine( " IsEmpty() = " + rd.IsEmpty() );
+ Console.WriteLine( " Left = " + rd.Left() );
+ Console.WriteLine( " Right = " + rd.Right() );
+ Console.WriteLine( " Top = " + rd.Top() );
+ Console.WriteLine( " Bottom = " + rd.Bottom() );
+ Console.WriteLine( " Area = " + rd.Area() );
+ }
+ Console.WriteLine( " *************************" );
+ RectDouble rd2 = new RectDouble();
+ rd2.x = 10;
+ rd2.y = 10;
+ rd2.width = 20;
+ rd2.height = 20;
+ Console.WriteLine( " Created " + rd2 );
+ Console.WriteLine( " IsEmpty() = " + rd2.IsEmpty() );
+ Console.WriteLine( " Left = " + rd2.Left() );
+ Console.WriteLine( " Right = " + rd2.Right() );
+ Console.WriteLine( " Top = " + rd2.Top() );
+ Console.WriteLine( " Bottom = " + rd2.Bottom() );
+ Console.WriteLine( " Area = " + rd2.Area() );
+
+ Console.WriteLine( " *************************" );
+ Vector2 vector2 = new Vector2(100, 50);
+ Console.WriteLine( " Created " + vector2 );
+ Console.WriteLine( " Vector2 x = " + vector2.x + ", y = " + vector2.y );
+ vector2 += new Vector2(20, 20);
+ Console.WriteLine( " Vector2 x = " + vector2[0] + ", y = " + vector2[1] );
+ vector2.x += 10;
+ vector2.y += 10;
+ Console.WriteLine( " Vector2 width = " + vector2.width + ", height = " + vector2.height );
+ vector2 += new Vector2(15, 15);
+ Console.WriteLine( " Vector2 width = " + vector2[0] + ", height = " + vector2[1] );
+
+ Console.WriteLine( " *************************" );
+ Vector3 vector3 = new Vector3(20, 100, 50);
+ Console.WriteLine( " Created " + vector3 );
+ Console.WriteLine( " Vector3 x = " + vector3.x + ", y = " + vector3.y + ", z = " + vector3.z );
+ vector3 += new Vector3(20, 20, 20);
+ Console.WriteLine( " Vector3 x = " + vector3[0] + ", y = " + vector3[1] + ", z = " + vector3[2] );
+ vector3.x += 10;
+ vector3.y += 10;
+ vector3.z += 10;
+ Console.WriteLine( " Vector3 width = " + vector3.width + ", height = " + vector3.height + ", depth = " + vector3.depth );
+ Vector3 parentOrigin = NDalic.ParentOriginBottomRight;
+ Console.WriteLine( " parentOrigin x = " + parentOrigin.x + ", y = " + parentOrigin.y + ", z = " + parentOrigin.z );
+
+ Console.WriteLine( " *************************" );
+ Vector4 vector4 = new Vector4(20, 100, 50, 200);
+ Console.WriteLine( " Created " + vector4 );
+ Console.WriteLine( " Vector4 x = " + vector4.x + ", y = " + vector4.y + ", z = " + vector4.z + ", w = " + vector4.w );
+ vector4 += new Vector4(20, 20, 20, 20);
+ Console.WriteLine( " Vector4 x = " + vector4[0] + ", y = " + vector4[1] + ", z = " + vector4[2] + ", w = " + vector4[3] );
+ vector4.x += 10;
+ vector4.y += 10;
+ vector4.z += 10;
+ vector4.w += 10;
+ Console.WriteLine( " Vector4 r = " + vector4.r + ", g = " + vector4.g + ", b = " + vector4.b + ", a = " + vector4.a );
+ }
+
+ public void MainLoop()
+ {
+ _application.MainLoop ();
+ }
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine ("Hello Mono World");
+
+ Example example = new Example(Application.NewApplication());
+ example.MainLoop ();
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+
+namespace MyCSharpExample
+{
+ class Example
+ {
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void CallbackDelegate(IntPtr data);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void TouchCallbackDelegate(IntPtr data);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void AnimationCallbackDelegate(IntPtr data);
+
+ private Dali.Application _application;
+
+ private Animation _animation;
+ private TextLabel _text;
+
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ _application.Initialized += new Dali.AUIApplicationInitEventHandler(Initialize);
+ }
+
+ public void Initialize(object source, AUIApplicationInitEventArgs e)
+ {
+ Console.WriteLine("Customized Application Initialize event handler");
+ Stage stage = Stage.GetCurrent();
+ stage.SetBackgroundColor( NDalic.WHITE );
+
+ stage.Touched += new Dali.Stage.TouchEventHandler(OnStageTouched);
+
+ // Add a _text label to the stage
+ _text = new TextLabel("Hello Mono World");
+ _text.ParentOrigin = NDalic.ParentOriginCenter;
+ _text.AnchorPoint = NDalic.AnchorPointCenter;
+ _text.HorizontalAlignment = "CENTER";
+ _text.PointSize = 32.0f;
+
+ stage.Add(_text);
+ }
+
+ // Callback for _animation finished signal handling
+ public void AnimationFinished(object source, Animation.FinishedEventArgs e)
+ {
+ Console.WriteLine("Customized Animation Finished Event handler");
+ Console.WriteLine("Animation finished: duration = " + e.Animation.GetDuration());
+ }
+
+ // Callback for stage touched signal handling
+ public void OnStageTouched(object source, Stage.TouchEventArgs e)
+ {
+ //TouchData touchData = TouchData.GetTouchDataFromPtr( data );
+
+ // Only animate the _text label when touch down happens
+ if( e.TouchData.GetState(0) == PointStateType.DOWN )
+ {
+ Console.WriteLine("Customized Stage Touch event handler");
+ // Create a new _animation
+ if( _animation )
+ {
+ _animation.Reset();
+ }
+
+ _animation = new Animation(1.0f); // 1 second of duration
+
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f));
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f));
+
+ // Connect the signal callback for animaiton finished signal
+ _animation.Finished += new Dali.Animation.FinishedEventHandler(AnimationFinished);
+
+ // Play the _animation
+ _animation.Play();
+ }
+ }
+
+ public void MainLoop()
+ {
+ _application.MainLoop ();
+ }
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine ("Hello Mono World");
+
+ Example example = new Example(Application.NewApplication());
+ example.MainLoop ();
+ }
+ }
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+using Dali;
+
+namespace MyCSharpExample
+{
+ class Example
+ {
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void CallbackDelegate(IntPtr data);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ delegate void ActorCallbackDelegate(IntPtr data);
+
+ private Dali.Application _application;
+ private ScrollView _scrollView;
+ private ScrollBar _scrollBar;
+
+ public Example(Dali.Application application)
+ {
+ _application = application;
+ _application.Initialized += new Dali.AUIApplicationInitEventHandler(Initialize);
+ }
+
+
+ public void Initialize(object source, AUIApplicationInitEventArgs e)
+ {
+ CreateScrollView();
+ }
+
+ private void CreateScrollView()
+ {
+ Stage stage = Stage.GetCurrent();
+ stage.SetBackgroundColor(NDalic.WHITE);
+
+ // Create a scroll view
+ _scrollView = new ScrollView();
+ Vector2 stageSize = stage.GetSize();
+ _scrollView.Size = new Vector3(stageSize.x, stageSize.y, 0.0f);
+ _scrollView.ParentOrigin = NDalic.ParentOriginCenter;
+ _scrollView.AnchorPoint = NDalic.AnchorPointCenter;
+ stage.Add(_scrollView);
+
+ // Add actors to a scroll view with 3 pages
+ int pageRows = 1;
+ int pageColumns = 3;
+ for(int pageRow = 0; pageRow < pageRows; pageRow++)
+ {
+ for(int pageColumn = 0; pageColumn < pageColumns; pageColumn++)
+ {
+ Control pageActor = new Control();
+ pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
+ pageActor.ParentOrigin = NDalic.ParentOriginCenter;
+ pageActor.AnchorPoint = NDalic.AnchorPointCenter;
+ pageActor.Position = new Vector3(pageColumn * stageSize.x, pageRow * stageSize.y, 0.0f);
+
+ // Add images in a 3x4 grid layout for each page
+ int imageRows = 4;
+ int imageColumns = 3;
+ float margin = 10.0f;
+ Vector3 imageSize = new Vector3((stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0f);
+
+ for(int row = 0; row < imageRows; row++)
+ {
+ for(int column = 0; column < imageColumns;column++)
+ {
+ int imageId = (row * imageColumns + column) % 2 + 1;
+ ImageView imageView = new ImageView("images/image-" + imageId + ".jpg");
+ imageView.ParentOrigin = NDalic.ParentOriginCenter;
+ imageView.AnchorPoint = NDalic.AnchorPointCenter;
+ imageView.Size = imageSize;
+ imageView.Position = new Vector3( margin * 0.5f + (imageSize.x + margin) * column - stageSize.x * 0.5f + imageSize.x * 0.5f,
+ margin * 0.5f + (imageSize.y + margin) * row - stageSize.y * 0.5f + imageSize.y * 0.5f, 0.0f );
+ pageActor.Add(imageView);
+ }
+ }
+
+ _scrollView.Add(pageActor);
+ }
+ }
+
+ _scrollView.SetAxisAutoLock(true);
+
+ // Set scroll view to have 3 pages in X axis and allow page snapping,
+ // and also disable scrolling in Y axis.
+ RulerPtr scrollRulerX = new RulerPtr(new FixedRuler(stageSize.width));
+ RulerPtr scrollRulerY = new RulerPtr(new DefaultRuler());
+ scrollRulerX.SetDomain(new RulerDomain(0.0f, stageSize.width * pageColumns, true));
+ scrollRulerY.Disable();
+ _scrollView.SetRulerX(scrollRulerX);
+ _scrollView.SetRulerY(scrollRulerY);
+
+ // Create a horizontal scroll bar in the bottom of scroll view (which is optional)
+ _scrollBar = new ScrollBar();
+ _scrollBar.ParentOrigin = NDalic.ParentOriginBottomLeft;
+ _scrollBar.AnchorPoint = NDalic.AnchorPointTopLeft;
+ _scrollBar.SetResizePolicy(ResizePolicyType.FIT_TO_CHILDREN, DimensionType.WIDTH);
+ _scrollBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
+ _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
+ _scrollBar.SetScrollDirection(ScrollBar.Direction.Horizontal);
+ _scrollView.Add(_scrollBar);
+
+ // Connect to the OnRelayout signal
+ _scrollView.OnRelayoutEvent += new Dali.Actor.OnRelayoutEventHandler(OnScrollViewRelayout);
+ }
+
+ private void OnScrollViewRelayout(object source, Actor.OnRelayoutEventArgs e)
+ {
+ // Set the correct scroll bar size after size negotiation of scroll view is done
+ _scrollBar.Size = new Vector3(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f);
+ }
+
+ public void MainLoop()
+ {
+ _application.MainLoop ();
+ }
+
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Example example = new Example(Application.NewApplication());
+ example.MainLoop ();
+ }
+ }
+}
--- /dev/null
+#!/usr/bin/env ruby
+require 'pathname'
+require 'scanf'
+
+# Script does the following:
+# - greps dali-core for DALI_PROPERTY macro which holds all the information about a property ( type, read only etc)
+# - uses the filename of the macro to detect the class the properties belong to. E.g. actor-impl.cpp = Actor
+# - Scans each property macro and builds a list of DALi classes with an array of properties
+# - Generates the csharp get/set code for each property
+# - Pastes the property get / set code into the DALi csharp files
+
+# Given a DALi C++ property type this table stores the
+# information needed to produce a csharp getter / setter
+$typeTable = [
+ ["BOOLEAN", "bool", "ref", "bool temp = false;"],
+ ["FLOAT", "float", "ref", "float temp = 0.0f;"],
+ ["INTEGER", "int", "ref", "int temp = 0;"],
+ ["VECTOR2", "Vector2", "", "Vector2 temp = new Vector2(0.0f,0.0f);"],
+ ["VECTOR3", "Vector3", "", "Vector3 temp = new Vector3(0.0f,0.0f,0.0f);"],
+ ["VECTOR4", "Vector4", "", "Vector4 temp = new Vector4(0.0f,0.0f,0.0f,0.0f);"],
+ ["MATRIX3", "Matrix3", "", "Matrix3 temp = new Matrix3();"],
+ ["MATRIX", "Matrix", "", "Matrix temp = new Matrix();" ],
+ ["RECTANGLE", "RectInteger", "", "RectInteger temp = new RectInteger(0,0,0,0);"],
+ ["ROTATION", "Quaternion", "", "Quaternion temp = new Quaternion();"],
+ ["STRING", "string", "out", "string temp;"],
+ ["ARRAY", "Dali.Property.Array", "", "Dali.Property.Array temp = new Dali.Property.Array();"],
+ ["MAP", "Dali.Property.Map", "", "Dali.Property.Map temp = new Dali.Property.Map();"],
+ ]
+$daliSwigPath = String.new;
+
+# use the table above to get information for a specific type
+def getCSharpType( type )
+
+ entry = $typeTable.select{ |a| a.first == type }
+ if( entry == nil )
+ return nil
+ end
+ return entry[0]
+end
+
+
+# Property struct stores the information about a property after parsing the C++ DALI_PROPERTY macro
+$propertyStruct = Struct.new("Property", :name, :type, :writable, :animatable,:constrainInput, :enum, :shortenum, :csharpGetter, :csharpSetter, :childProperty,)
+
+# daliClass struct stores a class name and an array of properties
+$daliClassStruct = Struct.new("DaliClass", :name, :properties )
+
+# class array stores all the dali classes ( actor, image etc)
+$daliClassArray = Array.new
+
+# list of files not generated by swig that we have tried to inject properties into
+$filesNotWrapped= Array.new
+
+# stats
+$totalProperties = 0
+$totalDaliClasses = 0
+
+# global paths
+$rootPath = ""
+$daliCorePath = ""
+$daliSwigPath = ""
+
+# Extracts data DALI__PROPERTY( "points", ARRAY,true,false,false,Dali::Path::Property::POINTS )
+def extractPropertyInfo( propertyMacro )
+
+ # want to extract the property name, type + read only status
+ # split the DALI_PROPERTY macro definition by comma and quotes, and delete any empty segments
+ data = propertyMacro.split(/[\s,"]/).reject { |s| s.empty? }
+
+ propertyName = data[1]
+
+ # e.g. turn viewMatrix into ViewMatrix
+ propertyName[0] = propertyName[0].capitalize
+
+ # extract the property enum name Dali::Path::Property::POINTS -> POINTS
+ shortenum = data[6].split(":").last
+
+ # store the :name, :type, :writable, :animatable, :constrainInput, :enum
+ property = $propertyStruct.new;
+
+ property.name = propertyName
+ property.type = data[2]
+ property.writable = (data[3]=="true")
+ property.animatable = (data[4] == "true")
+ property.constrainInput = (data[5]=="true")
+ property.enum = shortenum
+
+ return property;
+end
+
+# Extracts data from Toolkit property definition
+def extractToolkitPropertyInfo( propertyMacro )
+
+ # Extract the property name, type
+ property = $propertyStruct.new;
+
+ # Split the macro definition by comma and quotes, close bracket and delete any empty segments
+ data = propertyMacro.split(/[\s,")]/).reject { |s| s.empty? }
+
+ if(data[1] == "PropertyRegistration")
+
+ # Properties defined in Control using PropertyRegistration
+ # const PropertyRegistration Control::Impl::PROPERTY_1(typeRegistration, "styleName", Toolkit::Control::Property::STYLE_NAME, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+
+ # Creates an array of strings that looks like this:
+ # const 0
+ # PropertyRegistration 1
+ # Control::Impl::PROPERTY_1 2
+ # typeRegistration 3
+ # styleName 4
+ # Toolkit::Control::Property::STYLE_NAME 5
+ # Property::STRING 6
+ # &Control::Impl::SetProperty 7
+ # &Control::Impl::GetProperty 8
+ #
+
+ property.name = data[4]
+
+ propertyType = data[6].rpartition("::")
+ property.type = propertyType[2]
+
+ propertyEnum = data[5].rpartition("::")
+ property.enum = propertyEnum[2]
+
+ else
+
+ # Properties defined in macro DALI_PROPERTY_REGISTRATION or DALI_ANIMATABLE_PROPERTY_REGISTRATION or DALI_CHILD_PROPERTY_REGISTRATION
+ # or DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT:
+ # DALI_PROPERTY_REGISTRATION(Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE)
+ # DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, ImageView, "pixelArea", Vector4(0.f, 0.f, 1.f, 1.f), PIXEL_AREA)
+
+ # Creates an array of strings that looks like this:
+ # DALI_PROPERTY_REGISTRATION( 0
+ # Toolkit 1
+ # PageTurnView 2
+ # pageSize 3
+ # VECTOR2 4
+ # PAGE_SIZE 5
+ #
+
+ property.name = data[3]
+
+ #puts property.name
+ if property.name == "image"
+ property.name = "imageMap"
+ end
+
+ if( data[0] == "DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(" )
+ # TODO: Need to work out the property type from the value
+ property.type = "VECTOR4"
+ else
+ property.type = data[4]
+ end
+
+ property.enum = data[data.length-1]
+
+ end
+
+ # e.g. turn styleName into StyleName
+ property.name[0] = property.name[0].capitalize
+
+ property.writable = true
+ property.animatable = false
+ property.constrainInput = false
+ property.childProperty = false;
+
+ # check to see if it's a child property
+ if( data[0] == "DALI_CHILD_PROPERTY_REGISTRATION(" )
+ #puts(" #{property.name} is child property ")
+ property.childProperty = true;
+ end
+ if( data[0] == "DALI_ANIMATABLE_PROPERTY_REGISTRATION(" )
+ #puts(" #{property.name} is animatable")
+ property.animatable = true;
+ end
+
+ return property;
+end
+
+def writePropertiesToCSharpFile( daliClass )
+
+ # open the CSharp file autogenerated by SWIG
+ swigFiles = $daliSwigPath + "/csharp/"
+
+ fileName =(swigFiles+daliClass.name) + ".cs"
+
+ # it's possible some classes in dali-core aren't being wrapped by swig, so if the swig generated file
+ # doesn't exist just return
+ if( ! File.exist?(fileName) )
+ $filesNotWrapped.push("#{daliClass.name}.cs ")
+ return
+ end
+
+ File.open(fileName, 'r+') do |file|
+
+ last_line =0
+ file.each { last_line = file.pos unless file.eof? }
+
+ # we seek to the end of the file... minus 3 characters which lets us overwrite the 2 closing brackets
+ # so we can insert the getter/setter stuff into the file.
+ file.seek( last_line-3, IO::SEEK_SET)
+
+ for property in daliClass.properties
+
+ if (!property.childProperty)
+ file.write( property.csharpGetter );
+ file.write( property.csharpSetter );
+ end
+
+ end
+
+ file.write("\n}\n\n}"); # re-insert the closing brackets we over-wrote
+ end
+
+ puts("Injected #{daliClass.properties.length} C# Properties into #{daliClass.name}.cs".blueBackground)
+
+end
+
+def writeChildPropertiesToCSharpFile( daliClass )
+
+ # open the CSharp file autogenerated by SWIG
+ swigFiles = $daliSwigPath + "/csharp/"
+
+ # Add all the child properties to Control
+ fileName = (swigFiles+"Control") + ".cs"
+
+ if( ! File.exist?(fileName) )
+ return
+ end
+
+ File.open(fileName, 'r+') do |file|
+
+ last_line =0
+ file.each { last_line = file.pos unless file.eof? }
+
+ # we seek to the end of the file... minus 3 characters which lets us overwrite the 2 closing brackets
+ # so we can insert the getter/setter stuff into the file.
+ file.seek( last_line-3, IO::SEEK_SET)
+
+ $childPropertyCount = 0
+
+ for property in daliClass.properties
+
+ if (property.childProperty)
+ file.write( property.csharpGetter );
+ file.write( property.csharpSetter );
+ $childPropertyCount += 1
+ end
+
+ end
+
+ file.write("\n}\n\n}"); # re-insert the closing brackets we over-wrote
+ end
+
+ puts("Injected #{$childPropertyCount} C# Child Properties into #{"Control"}.cs".blueBackground)
+
+end
+
+# Write the CSharp data to the generated .cs file
+def writeCSharpData
+
+ for daliClass in $daliClassArray
+
+ #puts ( daliClass.name )
+
+ hasChildProperties = false
+
+ for property in daliClass.properties
+ propertyInfo = getCSharpType( property.type )
+
+ if( propertyInfo.length() < 2 )
+ # some types aren't supported yet like Rotation
+ next
+ end
+
+ $totalProperties+=1 # keep track of total
+
+ propertyType = propertyInfo[1] # e.g. bool or int
+ propertyArg = propertyInfo[2] # e.g. ref or out
+ tempDeclaration = propertyInfo[3] # e.g. bool temp;
+
+ propertyName = "#{daliClass.name}.Property.#{property.enum}"
+
+ if property.childProperty
+ propertyName = "#{daliClass.name}.ChildProperty.#{property.enum}"
+ hasChildProperties = true
+ end
+
+ property.csharpGetter =" public #{propertyType} #{property.name} \n"\
+ " { \n"\
+ " get \n" \
+ " {\n"\
+ " #{tempDeclaration}\n"\
+ " GetProperty( #{propertyName}).Get( #{propertyArg} temp );\n"\
+ " return temp;\n"\
+ " }\n"
+
+ if property.writable
+ #text.SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Property.Value("CENTER"));
+ property.csharpSetter = " set \n" \
+ " { \n"\
+ " SetProperty( #{propertyName}, new Dali.Property.Value( value ) );\n" \
+ " }\n"\
+ " }\n"
+ else
+ property.csharpSetter = "}" # close the opening property declaration
+ end
+ end
+ # write normal properties to the class's own csharp file
+ writePropertiesToCSharpFile( daliClass )
+ # write child properties to Control.cs
+ if (hasChildProperties)
+ writeChildPropertiesToCSharpFile( daliClass )
+ end
+ end
+
+end
+
+def getDaliClassItem( className )
+
+ # puts( "getDaliClassItem "+ className )
+ index = $daliClassArray.index{ |a| a.name == className }
+
+ if( index == nil)
+ # create a new item along with a array for it's properites
+ classItem = $daliClassStruct.new( className, Array.new )
+ $daliClassArray.push( classItem )
+ $totalDaliClasses+=1 # for stats
+ else
+ # puts("class found " + className )
+ classItem = $daliClassArray[ index ]
+ end
+
+ return classItem;
+
+end
+
+
+
+def init
+
+ pn = Pathname.new(Dir.pwd)
+ fullPath = pn.to_s
+
+ $rootPath = fullPath.slice(0..( fullPath.index('/dali-toolkit')))
+ $daliCorePath = $rootPath + "dali-core/dali" # source code path
+ $daliSwigPath = $rootPath + "dali-toolkit/plugins/dali-swig"
+ $daliToolkitPath = $rootPath + "dali-toolkit/dali-toolkit" # source code path
+
+ puts("--------------------------------------------")
+ puts("Injecting DALi properties into SWIG generated C# files ")
+ puts("")
+
+
+end
+
+def writeDaliCoreProperties
+
+ puts("Scanning for DALI_PROPERTY macro in dali-core");
+ puts("Scanning folder: #{$daliCorePath}\n\n");
+
+ # Executed a recursive grep over dali-core for the DALI_PROPERTY macro
+ result =`grep --include *.cpp -r "DALI_PROPERTY( \" #{$daliCorePath}`
+
+
+ # We now have a list of lines that look like this:
+ # dali/internal/event/animation/path-impl.cpp:DALI__PROPERTY( "points", ARRAY,true,false,false,Dali::Path::Property::POINTS )
+
+ lines = result.split(/\n+/);
+ for line in lines
+
+
+ # Split the line into file name and property macro, splt 2 means just create two strings as we don't want to split
+ # property Dali::Path::Property::POINTS string as well
+
+ data = line.split(":",2)
+ fileName = data[0];
+ macro = data[1];
+
+ # Get the class name from the filename ( e.g. image-actor-impl.cpp => image-actor)
+ className = File.basename(fileName,"-impl.cpp").capitalize
+
+ # convert it from image-actor to ImageActor
+ className = className.split(/ |\_|\-/).map(&:capitalize).join
+
+ # Get the property information ( name, type, read/writeable)
+ propertyInfo = extractPropertyInfo( macro );
+
+ # get or create a new DALi class item which stores the property information
+ classItem = getDaliClassItem( className )
+
+ classItem.properties.push( propertyInfo )
+
+ end
+
+ writeCSharpData()
+end
+
+def writeDaliToolkitProperties
+
+
+ puts("\nScanning for PROPERTY_REGISTRATION macros in dali-toolkit");
+ puts("Scanning folder: #{$daliToolkitPath}\n\n");
+
+ $daliClassArray.clear;
+
+ # Executed a recursive grep over dali-toolkit for following macros
+ # DALI_PROPERTY_REGISTRATION
+ # DALI_ANIMATABLE_PROPERTY_REGISTRATION
+ # DALI_CHILD_PROPERTY_REGISTRATION
+ result =`grep --include *.cpp -w 'Control::Impl::SetProperty\\|DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(\\|DALI_CHILD_PROPERTY_REGISTRATION(\\|DALI_ANIMATABLE_PROPERTY_REGISTRATION(\\|DALI_PROPERTY_REGISTRATION' -r #{$daliToolkitPath}`
+
+ if( result == "" )
+ puts("Error parsing #{$daliToolkitPath} no properties found")
+ return
+ end
+ # create an array to store each DALi class and it's assoc
+ classArray = Array.new
+
+ # We now have a list of lines that look like this:
+ # text-controls/text-label-impl.cpp:DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE )
+ lines = result.split(/\n+/);
+ for line in lines
+
+
+ # Split the line into file name and property macro, split 2 means just create two strings
+ data = line.split(":",2)
+ fileName = data[0];
+ macro = data[1];
+
+ # Get the class name from the filename ( e.g. image-actor-impl.cpp => image-actor)
+ className = File.basename(fileName,"-impl.cpp").capitalize
+
+ # convert it from image-actor to ImageActor
+ className = className.split(/ |\_|\-/).map(&:capitalize).join
+
+ #puts(className);
+ #puts(fileName);
+
+ # Get the property information ( name, type, read/writeable)
+ propertyInfo = extractToolkitPropertyInfo( macro );
+
+ # get or create a new DALi class item which stores the property information
+ classItem = getDaliClassItem( className )
+
+ classItem.properties.push( propertyInfo )
+
+ end
+
+ writeCSharpData()
+
+end
+
+# helper class to color the background
+class String
+def blueBackground; "\e[44m#{self}\e[0m" end
+end
+
+def writeStats
+
+ puts("\nFiles that have not been wrapped file by SWIG ( not included in dali.i file):")
+ for i in $filesNotWrapped
+ puts(i)
+ end
+
+ puts("Done. Injected #{$totalProperties} properties into #{$totalDaliClasses} DALi C# classes".blueBackground)
+
+end
+
+init()
+
+writeDaliCoreProperties()
+
+writeDaliToolkitProperties()
+
+writeStats()
+
--- /dev/null
+swig -csharp -c++ -outdir ./csharp -namespace Dali -o ./cpp/dali_wrap.cpp ./SWIG/dali.i