From: Victor Cebollada Date: Thu, 19 Mar 2015 10:18:35 +0000 (+0000) Subject: Alignment option added. X-Git-Tag: dali_1.0.38~7^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F12%2F37112%2F2;p=platform%2Fcore%2Fuifw%2Fdali-demo.git Alignment option added. Change-Id: I5f0e4ad2e2b52cd25aa8661dd95f688ac6c41a8b Signed-off-by: Victor Cebollada --- diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index 666579a..a68e7f5 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -36,8 +36,18 @@ namespace { const unsigned int KEY_ZERO = 10; const unsigned int KEY_ONE = 11; + const unsigned int KEY_A = 38; const unsigned int KEY_M = 58; const unsigned int KEY_L = 46; + + const char* ALIGNMENT_STRING_TABLE[] = + { + "BEGIN", + "CENTER", + "END" + }; + + const unsigned int ALIGNMENT_STRING_COUNT = sizeof( ALIGNMENT_STRING_TABLE ) / sizeof( ALIGNMENT_STRING_TABLE[0u] ); } /** @@ -49,7 +59,8 @@ public: TextLabelExample( Application& application ) : mApplication( application ), - mLanguageId( 0u ) + mLanguageId( 0u ), + mAlignment( 0u ) { // Connect to the Application's Init signal mApplication.InitSignal().Connect( this, &TextLabelExample::Create ); @@ -108,6 +119,16 @@ public: mLabel.SetProperty( TextLabel::Property::RENDERING_BACKEND, event.keyCode - 10 ); break; } + case KEY_A: + { + if( ++mAlignment >= ALIGNMENT_STRING_COUNT ) + { + mAlignment = 0u; + } + + mLabel.SetProperty( TextLabel::Property::ALIGNMENT, ALIGNMENT_STRING_TABLE[ mAlignment ] ); + break; + } case KEY_M: { bool multiLine = mLabel.GetProperty( TextLabel::Property::MULTI_LINE ); @@ -124,6 +145,7 @@ public: { mLanguageId = 0u; } + break; } } } @@ -137,6 +159,7 @@ private: TextLabel mLabel; unsigned int mLanguageId; + unsigned int mAlignment; }; void RunTest( Application& application )